An Introduction to Scikit-Learn: Machine Learning in Python

28 An Introduction to Scikit-Learn: Machine Learning in Python のメモ

  1. from sklearn.datasets import load_iris
    import kagglehub
    path = kagglehub.dataset_download("uciml/red-wine-quality-cortez-et-al-2009")
    import pandas as pd
    import numpy as np
    from sklearn.model_selection import train_test_split
    from sklearn.externals import joblib
    import joblib
    from sklearn import preprocessing
    from sklearn.ensemble import RandomForestRegressor
    from sklearn.pipeline import make_pipeline
    from sklearn.model_selection import GridSearchCV
    from sklearn.metrics import mean_squared_error, r2_score
    
    wine = pd.read_csv('winequality-red.csv')
    wine = pd.read_csv(path+'/winequality-red.csv')
    
  2. # Declare hyperparameters to tune
    hyperparameters = { 'randomforestregressor__max_features' : ['auto','sqrt'],
    hyperparameters = { 'randomforestregressor__max_features' : ['sqrt', 'log2'],
    'randomforestregressor__max_depth': [None, 1, 2, 4]}
    

坂本直志 <sakamoto@c.dendai.ac.jp>
東京電機大学工学部情報通信工学科