Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
metody_eksploracji_danych [2016/11/06 20:38]
pszwed [Laboratorium 1/2]
metody_eksploracji_danych [2016/11/06 20:38]
pszwed
Line 3: Line 3:
 ===== Laboratoria ===== ===== Laboratoria =====
  
-[[med_lab_1|Laboratorium 1]] +  *[[med_lab_1|Laboratorium 1]] 
-[[med_lab_2|Laboratorium 2]] +  *[[med_lab_2|Laboratorium 2]]
- +
-===== Laboratorium 1 ===== +
- +
- {{:med:med-lab01.pdf|Opis zadań (PDF)}} +
-==== Zbiory danych ==== +
- +
-  *[[http://home.agh.edu.pl/~pszwed/med/regression/xy-001.arff]] +
-  *[[http://home.agh.edu.pl/~pszwed/med/regression/xy-002.arff]] +
-  *[[http://home.agh.edu.pl/~pszwed/med/regression/xy-003.arff]] +
-  *[[http://home.agh.edu.pl/~pszwed/med/regression/xy-004.arff]] +
-  *[[http://home.agh.edu.pl/~pszwed/med/regression/xy-005.arff]] +
-  *[[http://home.agh.edu.pl/~pszwed/med/regression/xy-006.arff]] +
-  *[[http://home.agh.edu.pl/~pszwed/med/regression/xy-007.arff]] +
-  *[[http://home.agh.edu.pl/~pszwed/med/regression/xy-008.arff]] +
-  *[[http://home.agh.edu.pl/~pszwed/med/regression/xy-009.arff]] +
-  *[[http://home.agh.edu.pl/~pszwed/med/regression/xy-010.arff]] +
- +
-==== Kod Python ==== +
- +
-Poniżej zamieszczony kod może posłużyć do wizualizacji danych. +
- +
-  - Dane należy wprowadzić, jako tekst ''data='' +
-  - Formułę funkcji regresji w wierszu ''fy=2.3702*fx+6.1973''. Oczywiście ''2.3702'' i ''6.1973'' to parametry wyznaczone podczas regresji +
-  - Kod można uruchomić  +
-       * W IDE Spyder +
-       * Uruchamiając lokalnie Jupyter Notebook i wprowadzając kod w przeglądarce +
-       * Online: [[https://try.jupyter.org/]] +
- +
- +
-<code python> +
-%matplotlib notebook +
- +
-import matplotlib.pyplot as plt +
-import numpy as np +
-from scipy import stats +
-from io import StringIO +
-from sklearn import linear_model +
- +
- +
- +
-data = """ +
-0.246939,9.011391 +
-0.895519,8.950505 +
-0.971588,9.671047 +
-1.188316,14.735488 +
-1.741884,10.265625 +
-2.196002,13.501097 +
-2.637403,13.887849 +
-2.788188,17.180626 +
-3.50202,19.321529 +
-""" +
-#enter data as a string +
-inp =  StringIO(data) +
-x, y = np.loadtxt(inp, delimiter=',', usecols=(0, 1), unpack=True,skiprows=6) +
- +
-plt.scatter(x,y,s=80, marker='+'+
- +
- +
-#plot function  +
-#fx - arguments  +
-#fy - values,  +
-#ftrue -function used to generate data +
-  +
-fx=np.linspace(-10,60,100) +
-fy=2.3702*fx+6.1973  +
-ftrue=2.37*fx+7 +
-plt.plot(fx,fy,linewidth=2,color='r'+
-plt.plot(fx,ftrue,linewidth=1,linestyle='--',color='g'+
- +
-plt.xlim(-10,60) +
-plt.grid(True) +
-plt.xlabel('X'+
-plt.ylabel('Y'+
- +
-r = stats.pearsonr(x, y)[0]  +
-plt.title('Regression $f_{true} = 2.37x+7$ r=' + str(r)) +
- +
-plt.show() +
- +
-</code> +
- +
-=== Spyder === +
- +
-Aby wynik wyświetlił się w osobnym oknie... +
- +
-{{:med:spyder_opcje.png?200|}} +
- +
-=== Knowledge Explorer === +
- +
-W KnowledgeFlow nie jest widoczne menu kontekstowe. +
- +
-:!: Należy uruchomić korzystając z maszyny wirtualnej 1.7 z dystrybucji Oracle, a nie OpenJDK +
- +
-<!-- +
-Uruchom java VM z parametrem: +
--Dsun.java2D.xrender=false +
---> +
  
  
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0