Machine Learning/[Kaggle Course] ML (+ 딥러닝, 컴퓨터비전)

[Kaggle Courses] From Fitting to Prediction

WakaraNai 2020. 9. 26. 16:37
728x90
반응형

1. Selecting Data for Modeling

data = pd.read_csv( filename )
data.columns
data = data.dropna(axis=0)

- Selecting The Prediction Target:

  • Dot-notation: 필요한 column 추출 
  • prediction target(y)
y = data.Price

 

2. Choosing "Features" (X)

data_features = ['Rooms', 'Bathroom', 'Landsize', 'Lattitude', 'Longtitude']
X = data[data_features]

 

 

3. Building My Model

  1. Define: model의 타입은?( 결정트리? 다른 거?)
  2. Fit: data의 패턴을 포착해라
  3. predict
  4. evaluate
from sklearn.tree imoprt DecisionTreeRegressor
data_model = DecisionTreeRegressor(random_state=1)
data_model.fit(X,y)
# data_model.predict(X.head())
# data_model.predict(X)

 

728x90
반응형