9951 explained code solutions for 126 technologies


python-scikit-learnUsing quantile transformer example


from sklearn import preprocessing

qt = preprocessing.QuantileTransformer(n_quantiles=3)
data = [[1, 2], [3, 2], [4, 5]]
qt.fit(data)

transformed = qt.transform(data)ctrl + c
from sklearn import

import module from scikit-learn

.QuantileTransformer(

creates quantile transformer model

n_quantiles

number of quantiles to be computed

.fit(

train transformation model

.transform(

transform original data and return transformed data


Usage example

from sklearn import preprocessing

qt = preprocessing.QuantileTransformer(n_quantiles=3)
data = [[1, 2], [3, 2], [4, 5]]
qt.fit(data)

transformed = qt.transform(data)
print(transformed)
output
[[0.  0. ]
 [0.5 0. ]
 [1.  1. ]]