1 Star 0 Fork 0

起个名字吧/Machine-Learning-with-Python

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
tpot_Mercedes_testing_time_pipeline.py 1.08 KB
Copy Edit Raw Blame History
Susan Li authored 2019-01-04 19:55 . Add notebook
import numpy as np
import pandas as pd
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsRegressor
from sklearn.pipeline import make_pipeline, make_union
from tpot.builtins import StackingEstimator
# NOTE: Make sure that the class is labeled 'target' in the data file
tpot_data = pd.read_csv('PATH/TO/DATA/FILE', sep='COLUMN_SEPARATOR', dtype=np.float64)
features = tpot_data.drop('target', axis=1).values
training_features, testing_features, training_target, testing_target = \
train_test_split(features, tpot_data['target'].values, random_state=None)
# Average CV score on the training set was:-74.90881962449828
exported_pipeline = make_pipeline(
StackingEstimator(estimator=KNeighborsRegressor(n_neighbors=47, p=1, weights="uniform")),
RandomForestRegressor(bootstrap=True, max_features=0.25, min_samples_leaf=16, min_samples_split=4, n_estimators=100)
)
exported_pipeline.fit(training_features, training_target)
results = exported_pipeline.predict(testing_features)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/give_me_a_name/Machine-Learning-with-Python.git
git@gitee.com:give_me_a_name/Machine-Learning-with-Python.git
give_me_a_name
Machine-Learning-with-Python
Machine-Learning-with-Python
master

Search

23e8dbc6 1850385 7e0993f3 1850385