Programmazione Orientata agli Oggetti e Scripting in Python

[Pages:106]Scikit-learn

Programmazione Orientata agli Oggetti e

Scripting in Python

Matplotlib extra concepts

ListedColormap(colors) Colormap object generated from a list of colors. This may be most useful when indexing directly into a colormap, but it can also be used to generate special colormaps for ordinary mapping. colors: a list of matplotlib color specifications, or an equivalent Nx3 or Nx4 floating point array (N rgb or rgba values)

>>> from matplotlib.colors import ListedColormap >>> m = ListedColormap(['r','g','b']) #assigns the indexes: 0 for r, 1 for g, 2 for b

Matplotlib extra concepts

scatter(x, y, c = colors, cmap = colormap)

Make a scatter plot of x vs y x,y: sequence like objects (e.g., mono-dimensional arrays) of the same lengths. c : color or sequence of color, optional, default is blue. It can be

a single color format string a sequence of color specifications of length N a sequence of N numbers to be mapped to colors using the cmap and norm specified via kwargs (see below).

cmap : Colormap, optional, default: None

Matplotlib extra concepts

>>> import numpy as np >>> import matplotlib.pyplot as plt >>> N = 50 >>> x = np.random.rand(N) >>> y = np.random.rand(N) >>> colors = np.random.rand(N) >>> plt.scatter(x, y, c=colors) >>> plt.show()

Scikit-learn: basic information

Machine Learning library Designed to inter-operate with NumPy and SciPy Features:

Classification Clustering Regression ...

Website: Import

>>> import sklearn

What is Machine Learning?

ML: art of creating a compact explanation of the world using a large amount of data from the world Formally, ML is the field of computer science that deals with the study and the development of systems that can learn from data

What is Machine Learning?

Definitions

Model: the collection of parameters you are trying to fit Data: what you are using to fit the model Target: the value you are trying to predict with your model Features: attributes of your data that will be used in prediction Methods: algorithms that will use your data to fit a model

Learning problem

A learning problem considers a set of n samples of data and then tries to predict properties of unknown data Supervised learning

the systems learns from already labeled data (training set) how to predict the class of the unknown samples (test set). The task is called classification. if the desired output consists of one or more continuous variables, then the task is called regression.

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download