Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
metody_eksploracji_danych [2016/10/03 17:23] pszwed [Zbiory danych] |
— (current) | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Metody eksploracji danych ====== | ||
- | ===== Laboratorium 1 ===== | ||
- | |||
- | |||
- | ==== Zbiory danych ==== | ||
- | |||
- | [[http:// | ||
- | [[http:// | ||
- | [[http:// | ||
- | [[http:// | ||
- | [[http:// | ||
- | [[http:// | ||
- | [[http:// | ||
- | [[http:// | ||
- | [[http:// | ||
- | [[http:// | ||
- | |||
- | ==== Kod Python ==== | ||
- | |||
- | Poniżej zamieszczony kod może posłużyć do wizualizacji danych. | ||
- | |||
- | - Dane należy wprowadzić, | ||
- | - Formułę funkcji regresji w wierszu '' | ||
- | - Kod można uruchomić | ||
- | * W IDE Spyder | ||
- | * Uruchamiając lokalnie Jupyter Notebook i wprowadzając kod w przeglądarce | ||
- | * Online: [[https:// | ||
- | |||
- | |||
- | <code python> | ||
- | # % matplotlib notebook | ||
- | |||
- | import matplotlib.pyplot as plt | ||
- | import numpy as np | ||
- | from scipy import stats | ||
- | from io import StringIO | ||
- | |||
- | data = """ | ||
- | 0.246939, | ||
- | 0.895519, | ||
- | 0.971588, | ||
- | 1.188316, | ||
- | 1.741884, | ||
- | 2.196002, | ||
- | 2.637403, | ||
- | 2.788188, | ||
- | 3.50202, | ||
- | """ | ||
- | #enter data as a string | ||
- | inp = StringIO(data) | ||
- | x, y = np.loadtxt(inp, | ||
- | |||
- | plt.scatter(x, | ||
- | |||
- | |||
- | #plot function | ||
- | #fx - arguments | ||
- | #fy - values, | ||
- | #ftrue -function used to generate data | ||
- | |||
- | fx=np.linspace(-10, | ||
- | fy=2.3702*fx+6.1973 | ||
- | ftrue=2.37*fx+7 | ||
- | plt.plot(fx, | ||
- | plt.plot(fx, | ||
- | |||
- | plt.xlim(-10, | ||
- | plt.grid(True) | ||
- | plt.xlabel(' | ||
- | plt.ylabel(' | ||
- | |||
- | r = stats.pearsonr(x, | ||
- | plt.title(' | ||
- | |||
- | plt.show() | ||
- | |||
- | </ |