1
$\begingroup$

I'm making a model using sklearn.svm.SVC that would predict machine performance (ErrorID).

For the training of the model, I'm using 6 features, namely, EmployeeID, JobID, MachineID, Speed, RunningDateandTime, Meters and passing in ErrorID as labels.

Now for the prediction, I only have RunningDateandTime because I want to predict the performance in the future. But the model won't accept it because the number of features at the time of training and the number of features at the time of prediction is not same.

Is there any way to force the model to predict using only 1 feature while being trained on 5 features?

$\endgroup$
  • 1
    $\begingroup$ Why not train another model using only this feature? This is what will give you the best results if your test data has only this feature, but it might not be great anyway. $\endgroup$ – Erwan Jul 4 '19 at 16:17
2
$\begingroup$

Machine learning model is nothing but an equation (hypothesis), derived from the features (data set) used for model training. Using training dataset we optimize this equation by changing the coefficient(also known as weight) values with each iteration(or with each batch).

For example:

Basic Hypothesis where x1, x2, x3 are features and theta1, theta2, theta3 are weights...that we have to optimize with each iteration.

In order to get the results from this function, we need some value for x1, x2,and x3. This function wont work in case you feed just either of these values.

Best we can do in your case is to feed some average values for rest of the missing features. But then wont expect much from the model.

$\endgroup$
  • $\begingroup$ Your response makes sense. But can I train the model using RunningDateandTime only and expect the predictions to be useful or not? A sample value from RunningDateandTime looks like 2/6/2018 19:15 $\endgroup$ – moso11 Jul 4 '19 at 9:20
  • $\begingroup$ Sometimes I fill Machine learning is all about hit and trial :). You can give a try and analysis the results. But again single feature will give you a basic linear model(you can create polynomial as well), so expecting too much will be unfair. $\endgroup$ – vipin bansal Jul 4 '19 at 11:30
1
$\begingroup$

In case you train with features x1, x2, x3 but only have one feature for prediction (say x1), you could make assumptions about x2, x3. Generally you need to specify all features used for training when making predictions.

So what you can do is to say: okay if x2, x3 would look like this (make an assumption!), and given x1, the prediction is y.

If this makes sense in your case is a question you have to answer yourself based on your data. But if there is a meaningful „average“ of x2, x3 or in case you can group this features in some way, you may be able to get a good idea of what will happen in the future.

Note: using only one feature (such as time date) to train a model will likely not produce great predictions. However, ultimately you need to try.

$\endgroup$
0
$\begingroup$

The only case i've seen that handles missing values is the case of XGBoost, but then again, if you have samples that have missing values on some features, and in the real-world, you'd expect full inputs , i suggest you omit those samples. Even if you find something that works , generally relying on one feature and neglecting the others for prediction indicates that either you have a bad model or a bad problem formulation.

$\endgroup$
  • $\begingroup$ I think he has NO observations for all features except one to make predictions. $\endgroup$ – Peter Jul 4 '19 at 9:49
  • $\begingroup$ Yes, Peter is right. I don't have all the features to make predictions. Since I'd be predicting on a future ````RunningDateandTime```, I don't know who the operator of the machine might be, etc. Regarding the bad model, I'm open to using a different model implemented in any library. $\endgroup$ – moso11 Jul 4 '19 at 13:23
  • 1
    $\begingroup$ Then a feature you feed to the model that is unknown to you when you are doing inference is not a feature. i'm still not understanding correctly your problem, but i think those features need to be removed or be replaced by something available to you and correlated with your target variable ErrorID $\endgroup$ – Blenz Jul 4 '19 at 13:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.