1from sklearn.decomposition import KernelPCA
2kpca = KernelPCA(n_components = 2, kernel = 'rbf')
3X_train = kpca.fit_transform(X_train)
4X_test = kpca.transform(X_test)
1from sklearn import tree
2X = [[0, 0], [1, 1]]
3Y = [0, 1]
4clf = tree.DecisionTreeClassifier()
5clf = clf.fit(X, Y)
1python3 -m venv sklearn-venvpython -m venv sklearn-venvpython -m venv sklearn-venvsource sklearn-venv/bin/activatesource sklearn-venv/bin/activatesklearn-venv\Scripts\activatepip install -U scikit-learnpip install -U scikit-learnpip install -U scikit-learnpip3 install -U scikit-learnconda create -n sklearn-envconda activate sklearn-envconda install scikit-learn
1from sklearn import tree
2X = [[0, 0], [1, 1]]
3Y = [0, 1]
4clf = tree.DecisionTreeClassifier()
5clf = clf.fit(X, Y)
6
7# python3 -m venv sklearn-venvpython -m venv sklearn-venvpython -m venv sklearn-venvsource sklearn-venv/bin/activatesource sklearn-venv/bin/activatesklearn-venv\Scripts\activatepip install -U scikit-learnpip install -U scikit-learnpip install -U scikit-learnpip3 install -U scikit-learnconda create -n sklearn-envconda activate sklearn-envconda install scikit-learn
1from sklearn import linear_model
2regr = linear_model.LinearRegression()
3train_x = np.asanyarray(train[['ENGINESIZE']])
4train_y = np.asanyarray(train[['CO2EMISSIONS']])
5regr.fit (train_x, train_y)
6# The coefficients
7print ('Coefficients: ', regr.coef_)
8print ('Intercept: ',regr.intercept_)