0

I have done training on four features including Month, day, Hour and Temperature which is predicting some value , what i wan to do is to predict value on basis of month ,hour and day of next day only because i don't know the temp of next day(which is going to be unseen data not used in training) so this makes the testing of data using only 3 features. Classifier used is SVR. I am a beginner in machine learning.

Your response will be appreciated

3 Answers3

0

If you are predicting temperature, then month, day and hour are your features(x_train) and temperature is your target(y_train). You should train your model with features and targets in supervised learning. [regressor.fit(x_train, y_train)]

For testing, you should use your features (x_test) and the model will predict the target (y_predict) i.e Temperature the next day. [y_predict = regressor.predict(x_test)]. So you are using same number of features for training and testing.

Manojk07
  • 337
  • 2
  • 10
  • Thank you for your response. i am using 4 features for training and predicting some value(target var name ) but in test data i want to provide only 3 features to predict a value – Amna Rizvi Feb 19 '20 at 06:37
  • You should use the same number of features for testing as used for training. Month, day and Hour are your features and temperature is your target. You use features and target for training. During testing, you use features to predict the target. Hope it helps. – Manojk07 Feb 19 '20 at 08:05
0

Your idea does not work, the SVR will be trained on 4 features and you cannot run it with 3 features. So short answer: No

Longer answer: If you want to predict that value train the algorithm only with the 3 known features: Month, day, Hour (btw this is one feature: time), and you will have to work with a timeseries.

PV8
  • 5,799
  • 7
  • 43
  • 87
0

This is pretty obvious, you will not be having the dependent variable in your test set/real production set(after deployment in generic case). Hence, while training you can divide your dataset into train and test, example: df_x = df[:-1] (Independent variables) df_y = df[-1] (Dependent variable, temperature in your case) Now you can divide this in train and test (for basic use ratios in train_test_split), and train on train set and predict on test set. Reference: https://medium.com/@contactsunny/how-to-split-your-dataset-to-train-and-test-datasets-using-scikit-learn-e7cf6eb5e0d Hope this helps!