spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmvllt <>
Subject [MLLib] Is the order of the coefficients in a LogisticRegresionModel kept ?
Date Tue, 02 Feb 2016 17:21:44 GMT
Hi everyone,

This may sound like a stupid question but I need to be sure of this :

Given a dataframe composed by « n » features  : f1, f2, …, fn

For each row of my dataframe, I create a labeled point : 
val row_i = LabeledPoint(label, Vectors.dense(v1_i,v2_i,…, vn_i) ) 
where v1_i,v2_i,…, vn_i are respectively the values of the features f1, f2,
…, fn of the i th row.

Then, I fit a pipeline composed by a standardScaler and a logisticRegression
When I get back my LogisticRegressionModel and StandardScalerModel from the
pipeline, I’m calling the getters : 
LogisticRegressionModel.coefficients, StandardScalerModel.mean and

This gives me 3 vectors of length « n » 

My question is the following : 
Am I assured that the element of index « j » of each vectors correspond to 
the feature « j »  ? Is the "*order*" of the feature kept ?
e.g : Is StandardScalerModel.mean(j) the mean of the feature « j » of my
data frame ? 

Thanks for your time.

View this message in context:
Sent from the Apache Spark User List mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message