from sklearn.tree import DecisionTreeRegressor from sklearn.preprocessing import Imputer from sklearn import linear_model from encoder import encode_feature import pylab from sklearn.cross_validation import cross_val_score from sklearn.tree import DecisionTreeClassifier from sklearn import svm from sklearn.neighbors import KNeighborsClassifier os.chdir("/Users/anupdudani/Desktop/others/SJSUcoursework/CMPE239/Project") weather_df=pd.read_csv("weather_test_3.csv") modified_weather_df = encode_feature(weather_df,"Target") #print weather_df.head() #print weather_df.tail() #print modified_weather_df #print modified_weather_df.columns.values modified_weather_df["AirPressure"].fillna(0) modified_weather_df["WindSpeed"].fillna(0) modified_weather_df["Moisture"].fillna(0) modified_weather_df.info() target= modified_weather_df["Target_param"] y = target #print "target", y y=y.tolist()
cursor.execute(sql) # Commit your changes in the database db.commit() except: print "Inside exception" # Rollback in case there is any error db.rollback() db = MySQLdb.connect("localhost","root","Vinay1989","mydb" ) cursor = db.cursor() os.chdir("C:/SparkTest/NaturalCalamity") #os.chdir("/Users/anupdudani/Desktop/others/SJSUcoursework/CMPE239/Project") earthQuakeDestructivenessDf=pd.read_csv("destructiveNessOfEarthQuake.csv") modified_earthquake_destructiveness_df = encode_feature(earthQuakeDestructivenessDf,"destructiveness") modified_earthquake_destructiveness_df = encode_feature(modified_earthquake_destructiveness_df,"Population") modified_earthquake_destructiveness_df = encode_feature(modified_earthquake_destructiveness_df,"Secondary effects") modified_earthquake_destructiveness_df = encode_feature(modified_earthquake_destructiveness_df,"Architechture") print modified_earthquake_destructiveness_df.info() #print weather_df.head() #print weather_df.tail() #print modified_weather_df #print modified_weather_df.columns.values print "Classification with six Factors" modified_earthquake_destructiveness_df["Population_param"].fillna(0)
cursor.execute(sql) # Commit your changes in the database db.commit() except: print "Inside exception" # Rollback in case there is any error db.rollback() db = MySQLdb.connect("localhost", "root", "Vinay1989", "mydb") cursor = db.cursor() os.chdir("C:/SparkTest/NaturalCalamity") #os.chdir("/Users/anupdudani/Desktop/others/SJSUcoursework/CMPE239/Project") earthQuakeDestructivenessDf = pd.read_csv("destructiveNessOfEarthQuake.csv") modified_earthquake_destructiveness_df = encode_feature( earthQuakeDestructivenessDf, "destructiveness") modified_earthquake_destructiveness_df = encode_feature( modified_earthquake_destructiveness_df, "Population") modified_earthquake_destructiveness_df = encode_feature( modified_earthquake_destructiveness_df, "Secondary effects") modified_earthquake_destructiveness_df = encode_feature( modified_earthquake_destructiveness_df, "Architechture") print modified_earthquake_destructiveness_df.info() #print weather_df.head() #print weather_df.tail() #print modified_weather_df #print modified_weather_df.columns.values print "Classification with six Factors" modified_earthquake_destructiveness_df["Population_param"].fillna(0)
#print type(str(KNN_score)) cursor.execute(sql) # Commit your changes in the database db.commit() except: print "Inside exception" # Rollback in case there is any error db.rollback() db = MySQLdb.connect("localhost", "root", "Vinay1989", "mydb") cursor = db.cursor() os.chdir("C:/SparkTest/NaturalCalamity") #os.chdir("/Users/anupdudani/Desktop/others/SJSUcoursework/CMPE239/Project") weather_df = pd.read_csv("weather_test_3.csv") modified_weather_df = encode_feature(weather_df, "Target") #print weather_df.head() #print weather_df.tail() #print modified_weather_df #print modified_weather_df.columns.values modified_weather_df["AirPressure"].fillna(0) modified_weather_df["WindSpeed"].fillna(0) modified_weather_df["Moisture"].fillna(0) modified_weather_df["Moisure Density"].fillna(0) modified_weather_df["Snow"].fillna(0) #modified_weather_df.info() target = modified_weather_df["Target_param"] y = target