Created
          June 14, 2019 12:06 
        
      - 
      
 - 
        
Save MariaLavrovskaya/6943b82f6be100dce5e2873628c151f0 to your computer and use it in GitHub Desktop.  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | from sklearn import linear_model | |
| from sklearn.model_selection import train_test_split | |
| X_train, X_test, Y_train, Y_test = train_test_split(X_2, y,test_size = 0.25, random_state = 0) | |
| # Create linear regression object | |
| regr = linear_model.LinearRegression(fit_intercept=False) # Do not use fit_intercept = False if you have removed 1 column after dummy encoding | |
| # Train the model using the training sets | |
| regr.fit(X_train, Y_train) | |
| y_pred = regr.predict(X_test) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment