Skip to content

Instantly share code, notes, and snippets.

@nithyadurai87
Created November 2, 2018 09:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nithyadurai87/e0cca6ec864405a032888244122a90d8 to your computer and use it in GitHub Desktop.
Save nithyadurai87/e0cca6ec864405a032888244122a90d8 to your computer and use it in GitHub Desktop.
import pandas as pd
import matplotlib.pyplot as plt
import numpy
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split,cross_val_score
from sklearn.metrics import mean_squared_error
from math import sqrt
from sklearn.feature_selection import RFE
from sklearn.datasets import make_friedman1
df = pd.read_csv('./training_data.csv')
print (df.shape,df.columns)
# Dropping columns which has correlation with target less than threshold
target = "A"
correlations = df.corr()[target].abs()
correlations = correlations.round(2)
correlations.to_csv('./PV_MVDV_correlation.csv',index=False)
df=df.drop(correlations[correlations<0.06].index, axis=1)
print (df.shape,df.columns)
df.to_csv('./training.csv',index=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment