Predicting new feature combinations
Now that we have properly trained our predictor, we can use it besides capturing information about the product features’ importance to also provide us with information about how new product features will perform:
- After going through the EDA, we will develop some predictive models and compare them. We will use the DataFrame where we had created dummy variables, scaling all the variables to a range of 0 to 1:
from sklearn.preprocessing import StandardScaler
X = conjoint_dat_dum
y = conjoint_dat['ranking'].astype(int)
# The target variable will be normalized from a ranking to a 1 to 10 score
y = y.apply(lambda x: int(x/len(y)*10))
features = X.columns.values
scaler = StandardScaler()
scaler.fit(X)
X = pd.DataFrame(scaler.transform(X))
X.columns = features
This results in the following output:
Figure 4.14: Scaled variables
One of the most popular ML models is Logistic Regression, which is an algorithm that...