Answers.Body: <p>I think the model will have no problem taking a multicolumn input. In fact, from your code, this is exactly how you trained it. It expects an input of size [k, 6], where k is k>=1.</p>
  
  <p>Instead you are feeding it with [k, 1] sized data, which are the dimensions of <em>y</em>. So you if you run it like this it should work:</p>
  
  <p>regressionModel.predict(X)</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-10T10:50:08.403Z
Answers.LastActivityDate: 2018-03-10T10:50:08.403Z
Answers.UserDisplayName: hellmean
Body: <p>I was trying to build a prediction system where I have the input data arranged in multiple columns. The input data would be of the type where I have</p>
  <ul>
  <li>weather,</li>
  <li>service type (bronze, silver, gold),</li>
  <li>size (xs, s, m, l, xl, xxl),</li>
  <li>time,</li>
  <li>availability,</li>
  <li>pin code, and</li>
  <li>the result (target).</li>
  </ul>
  <p>Each of the data types is arranged in columns with a specific code. I have read <a href="https://stackoverflow.com/q/48385376/3924118">this</a>, <a href="https://stackoverflow.com/q/33369706/3924118">this</a>, <a href="https://stackoverflow.com/q/44613753/3924118">this</a> , <a href="https://stackoverflow.com/q/29625263/3924118">this</a>, and <a href="https://stackoverflow.com/q/3712863/3924118">this</a>.</p>
  <p>They are helpful but do not give me a clear picture. I would like to achieve a multi-vs-one prediction. Most of the schemes available are one-vs-one where the data is a 1*1 entity.</p>
  <p>Here is a sample code that I was working with:</p>
  <pre><code>regressionModel = linear_model.LinearRegression()
      &quot;&quot;&quot; 3. Processing is not necessary for current concept &quot;&quot;&quot;
      y = pd.DataFrame(modifiedDFSet['Code'])
      print(y.shape)
      drop2 = ['Code']
      X = modifiedDFSet.drop(drop2)
      print(X.shape)
      &quot;&quot;&quot; 4. Data Scaling, Data Imputation is not necessary. Training and Test data is prepared using train-test-split &quot;&quot;&quot;
      train_data, test_data = train_test_split(X, test_size=0.20, random_state=42)
      &quot;&quot;&quot; 5. the Regression Model &quot;&quot;&quot;
      # h = .02  # step size in the mesh
      # logreg = linear_model.LinearRegression()
      # we create an instance of Neighbours Classifier and fit the data.
      regressionModel.fit(X, y)
      d_predictions = regressionModel.predict(y)
  </code></pre>
  <p><code>X.shape</code> and <code>y.shape</code> would yield <code>(500, 6)</code> and <code>(500, 1)</code>, respectively, which would obviously cause a dimensional error in the <code>d_predictions</code>, meaning the regression model does not take multiple column inputs.</p>
  <p>I have a hypothesis that I can create a scoring scheme that will take into account the importance of each of the columns and create a scheme that creates a score and the end result would be a one-vs-one regression problem. <strong>Looking for some direction with respect to my hypothesis. Is it correct, wrong or halfway?</strong></p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-03-10T09:47:11.203Z
Comments.Text: No. I do not want to use any tool or software. I intend to hardcode using python 3x.  I am open to exploring new libraries. I am using scikit learn at the moment.
Comments.UserDisplayName: Vyasraj Vaidya
Tags: <machine-learning><linear-regression><data-science>
Title: multi vs one prediction using Regression
UserDisplayName: Vyasraj Vaidya
ThreadText: # multi vs one prediction using Regression
  
  (Asked by: username_0 on 2018-03-10)
  
  I was trying to build a prediction system where I have the input data arranged in multiple columns. The input data would be of the type where I have
  
  weather,
  service type (bronze, silver, gold),
  size (xs, s, m, l, xl, xxl),
  time,
  availability,
  pin code, and
  the result (target).
  
  Each of the data types is arranged in columns with a specific code. I have read this, this, this , this, and this.
  They are helpful but do not give me a clear picture. I would like to achieve a multi-vs-one prediction. Most of the schemes available are one-vs-one where the data is a 1*1 entity.
  Here is a sample code that I was working with:
  regressionModel = linear_model.LinearRegression()
      """ 3. Processing is not necessary for current concept """
      y = pd.DataFrame(modifiedDFSet['Code'])
      print(y.shape)
      drop2 = ['Code']
      X = modifiedDFSet.drop(drop2)
      print(X.shape)
      """ 4. Data Scaling, Data Imputation is not necessary. Training and Test data is prepared using train-test-split """
      train_data, test_data = train_test_split(X, test_size=0.20, random_state=42)
      """ 5. the Regression Model """
      # h = .02  # step size in the mesh
      # logreg = linear_model.LinearRegression()
      # we create an instance of Neighbours Classifier and fit the data.
      regressionModel.fit(X, y)
      d_predictions = regressionModel.predict(y)
  
  X.shape and y.shape would yield (500, 6) and (500, 1), respectively, which would obviously cause a dimensional error in the d_predictions, meaning the regression model does not take multiple column inputs.
  I have a hypothesis that I can create a scoring scheme that will take into account the importance of each of the columns and create a scheme that creates a score and the end result would be a one-vs-one regression problem. Looking for some direction with respect to my hypothesis. Is it correct, wrong or halfway?
  
  **Tags:** machine-learning, linear-regression, data-science
  > **Comments:**
  > **username_0**: No. I do not want to use any tool or software. I intend to hardcode using python 3x.  I am open to exploring new libraries. I am using scikit learn at the moment.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-03-10. Score: 1
  
  I think the model will have no problem taking a multicolumn input. In fact, from your code, this is exactly how you trained it. It expects an input of size [k, 6], where k is k>=1.
  
  Instead you are feeding it with [k, 1] sized data, which are the dimensions of *y*. So you if you run it like this it should work:
  
  regressionModel.predict(X)
  
  
  ---
  
  