Тема 5: Проектирование мультимедиа проектов и модели их разработки


Download 1.83 Mb.
bet4/6
Sana23.02.2023
Hajmi1.83 Mb.
#1223381
1   2   3   4   5   6
Bog'liq
3-mavzu-sirtqi

>>> from sklearn.preprocessing import StandardScaler >>> scaler = StandardScaler() >>> scaled_x = scaler.fit_transform(x) >>> scaler.scale_array([ 0.40311289, 4.03112887, 14.04421589]) >>> scaler.mean_array([ 0.65, 6.5 , 20.2 ]) >>> scaler.var_array([1.6250e-01, 1.6250e+01, 1.9724e+02]) >>> scaled_x_array([[-1.36438208, -1.36438208, 0.18512959], [-0.3721042 , -0.3721042 , 1.4952775 ], [ 1.36438208, 1.36438208, -1.23894421], [ 0.3721042 , 0.3721042 , -0.44146288]]) >>> scaled_x.mean().round(decimals=4) 0.0 >>> scaled_x.mean(axis=0) array([ 1.66533454e-16, -1.38777878e-17, 1.52655666e-16]) >>> scaled_x.std(axis=0) array([1., 1., 1.]) >>> scaler.inverse_transform(scaled_x) array([[ 0.1, 1. , 22.8], [ 0.5, 5. , 41.2], [ 1.2, 12. , 2.8], [ 0.8, 8. , 14. ]])

  • >>> from sklearn.preprocessing import StandardScaler >>> scaler = StandardScaler() >>> scaled_x = scaler.fit_transform(x) >>> scaler.scale_array([ 0.40311289, 4.03112887, 14.04421589]) >>> scaler.mean_array([ 0.65, 6.5 , 20.2 ]) >>> scaler.var_array([1.6250e-01, 1.6250e+01, 1.9724e+02]) >>> scaled_x_array([[-1.36438208, -1.36438208, 0.18512959], [-0.3721042 , -0.3721042 , 1.4952775 ], [ 1.36438208, 1.36438208, -1.23894421], [ 0.3721042 , 0.3721042 , -0.44146288]]) >>> scaled_x.mean().round(decimals=4) 0.0 >>> scaled_x.mean(axis=0) array([ 1.66533454e-16, -1.38777878e-17, 1.52655666e-16]) >>> scaled_x.std(axis=0) array([1., 1., 1.]) >>> scaler.inverse_transform(scaled_x) array([[ 0.1, 1. , 22.8], [ 0.5, 5. , 41.2], [ 1.2, 12. , 2.8], [ 0.8, 8. , 14. ]])

Misol uchun, sklearn.datasets.load_boston() funksiyasi Boston hududi uchun uy narxlari ma'lumotlarini ko'rsatadi (narxlar yangilanmagan!). 506 ta kuzatuv mavjud va kirish matritsasi 13 ta ustunga ega (xususiyatlar):

  • >>> from sklearn.datasets import load_boston >>> x, y = load_boston(return_X_y=True) >>> x.shape, y.shape ((506, 13), (506,))

Yana bir misol sharob bilan bog'liq ma'lumotlar to'plami. Uni sklearn.datasets.load_wine() funksiyasi yordamida olish mumkin:

  • >>> from sklearn.datasets import load_wine >>> x, y = load_wine(return_X_y=True) >>> x.shape, y.shape ((178, 13), (178,)) >>> np.unique(y) array([0, 1, 2])

Download 1.83 Mb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling