-1
$\begingroup$

I'am trying to create a regression based prediction (like booking website): predict the number of clicks for each hotel.

I have to generate a .csv file containing two columns:

  • hotel_id
  • predicted_number_of_clicks for all hotel_ids.

My first question question is: should I put the hotel_id as feature in the predictive model? I think that I must to drop it... right?

Second question is: how can I write in the csv file only this 2 columns if I drop hotel_id from the model features?

$\endgroup$
  • $\begingroup$ @Monozygotic thank you for reply. . Euh sincerely i unserstand a little bit.. Sorry but in wich step i include the id_hotel? It is unknown feature for the model $\endgroup$ – user17241 Feb 4 '15 at 0:26
1
$\begingroup$

Trying to classify using hotel ID is the same as trying to determine if a student is going to perform well on a test based on their last name. You should get additional things, like number of rooms, amenities, location, staff, etc. Those are informative features that you can use in a classifier

$\endgroup$
  • $\begingroup$ yes I have other features like num of room, num of stars.. but my question ih how the model predict the number oclicks for each num if hotel and it dont know num of hotel if i dont use these feature in training model? $\endgroup$ – user17241 Feb 4 '15 at 7:25
1
$\begingroup$

When training the model you don't need to use the hotel id. The model needs to learn from examples. It only needs feature values and number of clicks, so it can learn the relationship between these.

Once you've trained your model, you can use it for unseen examples. These would be hotels for which you have both an id and a set of feature values. Your model should take the id and the feature values as input, but it should only use the feature values for the prediction. The id should just be kept on the side, so it can print it together with the prediction to the output csv file.

I hope this helps!

$\endgroup$
1
$\begingroup$

Supervised learning should try to 'understand' what makes a hotel to have more clicks than other. As a consequence learning tries to define which are the characteristics of some given hotels which make them attractive or not. So it uses some kind of similarities, because it is supposed that similar hotels behaves in a similar way.

Now if you restrict the similarity to identity than you learn nothing new because hotels are unique. In fact such kind of learner exists and is called Rote learner, and it consists of one-to-one mapping from inputs to outputs. It is also called memoisation. And this happens if you will add hotel_id in the features. However I think you hope to use that to predict the number of clicks for new hotels (which does have a different hotel_id than any from training set).

On the other hand, in order to use hotel_id to store prediction you only have to save a copy of the original data set. At learning time you have a train data set from which you remove hotel_id, and use that for learning.

At prediction time you make a copy of the data set for later use. From the original data set remove order_id, use that for prediction and get the results. Now the predicted results have the same order of instances as the copied data set. This happens for sure in python (scikit learn), java (weka), R. In fact I am not aware of a system which does not preserve positions.

Now using positions from the copy of the original and prediction you can associate each hotel_id to each prediction with no problem.

$\endgroup$
0
$\begingroup$

The hotel_id should not be a feature.

Let's see if I understand you correctly.

At testing time you give your model a whole set of feature values for a particular hotel you are interested in. This hotel has an id, which is known to you.

Your model should be able to take both an id and a set of feature values as input, so it can print both to an output file.

Does that answer your question?

$\endgroup$
  • $\begingroup$ Add all of these comments in their respective answers, you are just adding clutter in this way $\endgroup$ – Leon palafox Feb 4 '15 at 17:53
  • $\begingroup$ I'm not allowed to leave comments yet... $\endgroup$ – Monozygotic Feb 5 '15 at 2:26
  • $\begingroup$ Could you maybe tell me which part of my answer should have been placed in a comment instead? This was actually the first answer posted to the question, so I couldn't place anything as a comment to other answers anyway. I don't really see what's wrong with the answer... $\endgroup$ – Monozygotic Feb 5 '15 at 2:45
  • $\begingroup$ You have two answers to the same question, your second answer should be a comment to the first, or just edit the first answer $\endgroup$ – Leon palafox Feb 5 '15 at 17:20
  • $\begingroup$ Ah I see. I'll keep that in mind for next time. :) $\endgroup$ – Monozygotic Feb 9 '15 at 5:23

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.