<jupyter_start><jupyter_text>TEST SET<jupyter_code>test.head()
test.isnull().sum()
test[["Minimum Temperature", "Maximum Temperature"]] = test["Cellar Temperature"].str.split("-", expand=True, n=1).astype(float)
test[["Minimum Serving Temperature", "Maximum Serving Temperature"]] = test["Serving Temperature"].str.split("-", expand=True, n=1).astype(float)
avg_abv1 = test["ABV"].astype("float").mean(axis=0)
test["ABV"].replace(np.nan, avg_abv1, inplace=True)

avg_min_temp1 = test["Minimum Temperature"].astype("float").mean(axis=0)
test["Minimum Temperature"].replace(np.nan, avg_min_temp1, inplace=True)

avg_max_temp1 = test["Maximum Temperature"].astype("float").mean(axis=0)
test["Maximum Temperature"].replace(np.nan, avg_max_temp1, inplace=True)

avg_minserv_temp1 = test["Minimum Serving Temperature"].astype("float").mean(axis=0)
test["Minimum Serving Temperature"].replace(np.nan, avg_minserv_temp1, inplace=True)

avg_maxserv_temp1 = test["Maximum Serving Temperature"].astype("float").mean(axis=0)
test["Maximum Serving Temperature"].replace(np.nan, avg_maxserv_temp1, inplace=True)
freq = nltk.FreqDist(test['Food Paring'])
for key,value in freq.items():
    print(str(key)+'  :  '+str(value))
test['Food Paring'] = test['Food Paring'].replace("(Curried,Thai)Cheese(pepperyMontereyPepperJack,sharpBlue,Cheddar,pungentGorgonzola,Limburger)Meat(Poultry,Fish,Shellfish,Salmon)" , "Thai, Cheese, Meat")
test['Food Paring'] = test['Food Paring'].replace("(Barbecue)Cheese(butteryBrie,Gouda,Havarti,Swiss)General(Chocolate,Dessert)Meat(Beef,SmokedMeat,GrilledMeat)" , "Barbecue, Cheese, General Food, Meat")
test['Food Paring'] = test['Food Paring'].replace("Cheese(earthyCamembert,Fontina)General(Aperitif)" , "Cheese, General Food")
test['Food Paring'] = test['Food Paring'].replace("(LatinAmerican,German)Meat(Pork,Poultry)" , "Meat")
test['Food Paring'] = test['Food Paring'].replace("(Barbecue)Cheese(pepperyMontereyPepperJack,sharpBlue,Cheddar,pungentGorgonzola,Limburger)Meat(Game,GrilledMeat,Salmon)" , "Barbecue, Cheese, Meat")
test['Food Paring'] = test['Food Paring'].replace("Cheese(butteryBrie,Gouda,Havarti,Swiss)General(Chocolate,Digestive)Meat(Beef,SmokedMeat,Game,GrilledMeat)" , "Cheese, General Food, Meat")
test['Food Paring'] = test['Food Paring'].replace("Meat(Poultry,Fish,Shellfish)" , "Meat")
test['Food Paring'] = test['Food Paring'].replace("Cheese(pepperyMontereyPepperJack,pungentGorgonzola,Limburger)General(Salad)" , "Cheese, General Food")
test['Food Paring'] = test['Food Paring'].replace("(Dessert)Meat(Poultry)" , "Dessert, Meat")
test['Food Paring'] = test['Food Paring'].replace("(Curried,Thai)Cheese(earthyCamembert,Fontina,nuttyAsiago,Colby,Parmesan,pungentGorgonzola,Limburger)General(Salad,Aperitif)Meat(Poultry,Fish,Shellfish)" , "Thai, Cheese, General Food, Meat")
test['Food Paring'] = test['Food Paring'].replace("(Curried,Indian,Thai,Chinese,Japanese,PanAsian)Cheese(sharpBlue,Cheddar)" , "Indian, Thai, Chinese, Japanese, PanAsian, Cheese")
test['Food Paring'] = test['Food Paring'].replace("(PanAsian)Cheese(earthyCamembert,Fontina,nuttyAsiago,Colby,Parmesan,tangyBrick,Edam,Feta)General(Salad)Meat(Poultry)" , "PanAsian, Cheese, General Food, Meat")
test['Food Paring'] = test['Food Paring'].replace("(Indian,Mediterranean,MiddleEastern)Cheese(pepperyMontereyPepperJack,sharpBlue,Cheddar)Meat(Fish,Shellfish)" , "Indian, Mediterranean, MiddleEastern, Cheese, Meat")
test['Food Paring'] = test['Food Paring'].replace("Cheese(sharpBlue,Cheddar,pungentGorgonzola,Limburger)General(Digestive)" , "Cheese, General Food")
test['Food Paring'] = test['Food Paring'].replace("Cheese(sharpBlue,Cheddar,pungentGorgonzola,Limburger)General(Dessert,Digestive)" , "Cheese, General Food")
test['Food Paring'] = test['Food Paring'].replace("Cheese(sharpBlue,Cheddar)Meat(Beef,Poultry,Fish)" , "Cheese, Meat")
test['Food Paring'] = test['Food Paring'].replace("(Salad)" , "Salad")
test['Food Paring'] = test['Food Paring'].replace("(Italian,German)Cheese(nuttyAsiago,Colby,Parmesan)Meat(Fish,Shellfish,Salmon)" , "Italian, German, Cheese, Meat")
test['Food Paring'] = test['Food Paring'].replace("Cheese(pepperyMontereyPepperJack,tangyBrick,Edam,Feta)General(Salad)Meat(Poultry,Fish,Shellfish)" , "Cheese, General Food, Meat")
test['Food Paring'] = test['Food Paring'].replace("(German)" , "German")
test['Food Paring'] = test['Food Paring'].replace("(Thai)Cheese(tangyBrick,Edam,Feta)General(Salad,Aperitif)Meat(Fish)" , "Thai, Cheese, General Food, Meat")
test['Food Paring'] = test['Food Paring'].replace("(Curried,Indian)Cheese(nuttyAsiago,Colby,Parmesan,sharpBlue,Cheddar)Meat(Shellfish)" , "Indian, Cheese, Meat")
test['Food Paring'] = test['Food Paring'].replace("(Barbecue)Cheese(butteryBrie,Gouda,Havarti,Swiss,earthyCamembert,Fontina)General(Chocolate,Dessert)Meat(Beef,Shellfish,SmokedMeat,Game,GrilledMeat)" , "Barbecue, Cheese, General Food, Meat")
test['Food Paring'] = test['Food Paring'].replace("Cheese(pepperyMontereyPepperJack)General(Chocolate)Meat(GrilledMeat)" , "Cheese, General Food, Meat")
test['Food Paring'] = test['Food Paring'].replace("(German)Cheese(butteryBrie,Gouda,Havarti,Swiss,earthyCamembert,Fontina)General(Chocolate)Meat(Game)" , "German, Cheese, General Food, Meat")
test['Food Paring'] = test['Food Paring'].replace("(German)Cheese(earthyCamembert,Fontina)Meat(SmokedMeat,Game,GrilledMeat)" , "German, Cheese, Meat")
test['Food Paring'] = test['Food Paring'].replace("(Dessert,Aperitif,Digestive)" , "Dessert")
test['Food Paring'] = test['Food Paring'].replace("(Indian,LatinAmerican,PanAsian)General(Aperitif)" , "Indian, LatinAmerican, PanAsian, General Food")
test['Food Paring'] = test['Food Paring'].replace("Cheese(butteryBrie,Gouda,Havarti,Swiss,pungentGorgonzola,Limburger)General(Chocolate)Meat(Beef)" , "Cheese, General Food, Meat")
test['Food Paring'] = test['Food Paring'].replace("Cheese(nuttyAsiago,Colby,Parmesan)General(Digestive)" , "Cheese, General Food")
test['Food Paring'] = test['Food Paring'].replace("(German)Cheese(butteryBrie,Gouda,Havarti,Swiss,sharpBlue,Cheddar)General(Salad,Aperitif)" , "German, Cheese, General Food")
test['Food Paring'] = test['Food Paring'].replace("(German)Cheese(tangyBrick,Edam,Feta)General(Salad)Meat(Poultry,Fish,Shellfish)" , "German, Cheese, Meat")
test['Food Paring'] = test['Food Paring'].replace("(Indian,MiddleEastern)Cheese(nuttyAsiago,Colby,Parmesan,tangyBrick,Edam,Feta)General(Salad,Aperitif)Meat(Fish,Shellfish)" , "Indian, MiddleEastern, Cheese, General Food, Meat")
test['Food Paring'] = test['Food Paring'].replace("(German)Cheese(earthyCamembert,Fontina)General(Chocolate)Meat(Game)" , "German, Cheese, General Food, Meat")
test['Food Paring'] = test['Food Paring'].replace("(Italian,MiddleEastern)Cheese(pepperyMontereyPepperJack)General(Salad)Meat(Fish)" , "Italian, MiddleEastern, Cheese, General Food, Meat")
test['Food Paring'] = test['Food Paring'].replace("(German)General(Salad)Meat(Pork,Fish,Shellfish)" , "German, General Food, Meat")
test['Food Paring'] = test['Food Paring'].replace("(Barbecue)Cheese(earthyCamembert,Fontina,nuttyAsiago,Colby,Parmesan)General(Chocolate)Meat(Beef)" , "Barbecue, Cheese, General Food, Meat")
test['Food Paring'] = test['Food Paring'].replace("(Aperitif,Digestive)Meat(Game,Salmon)" , "Meat")
test['Food Paring'] = test['Food Paring'].replace("(Barbecue,Italian)Cheese(earthyCamembert,Fontina)Meat(Pork,Poultry,Fish,Shellfish)" , "Barbecue, Italian, Cheese, Meat")
test['Food Paring'] = test['Food Paring'].replace("(Barbecue,Curried,Indian,LatinAmerican,Italian,Thai,Chinese,Japanese,PanAsian,Mediterranean,MiddleEastern)" , "Barbecue, Curried, Indian, LatinAmerican, Italian, Thai, Chinese, Japanese, PanAsian, Mediterranean, MiddleEastern")
test['Food Paring'] = test['Food Paring'].replace("(Barbecue)Cheese(pepperyMontereyPepperJack,sharpBlue,Cheddar,tangyBrick,Edam,Feta)General(Salad)Meat(Pork,Poultry,Fish,Shellfish)" , "Barbecue, Cheese, General Food, Meat")
test['Food Paring'] = test['Food Paring'].replace("(German)Meat(SmokedMeat,Game,GrilledMeat)" , "German, Meat")
test['Food Paring'] = test['Food Paring'].replace("(Japanese,German)Cheese(pepperyMontereyPepperJack)General(Aperitif)Meat(Poultry,Fish)" , "Japanese, German, Cheese, General Food, Meat")
test['Food Paring'] = test['Food Paring'].replace("(Barbecue)Cheese(earthyCamembert,Fontina)Meat(Beef,SmokedMeat,Game,GrilledMeat)" , "Barbecue, Cheese, Meat")
test['Food Paring'] = test['Food Paring'].replace("Cheese(butteryBrie,Gouda,Havarti,Swiss)Meat(SmokedMeat,Salmon)" , "Cheese, Meat")
test['Food Paring'] = test['Food Paring'].replace("(Mediterranean)Cheese(sharpBlue,Cheddar,pungentGorgonzola,Limburger)Meat(Pork,Poultry)" , "Mediterranean, Cheese, Meat")
test['Food Paring'] = test['Food Paring'].replace("(German)Cheese(pepperyMontereyPepperJack)General(Salad)Meat(Pork)" , "German, Cheese, General Food, Meat")
test['Food Paring'] = test['Food Paring'].replace("(Barbecue,Curried,Indian,LatinAmerican,Chinese)Cheese(sharpBlue,Cheddar)General(Aperitif,Digestive)Meat(Shellfish,Game)" , "Barbecue, Curried, Indian, LatinAmerican, Chinese, Cheese, General Food, Meat")
test['Food Paring'] = test['Food Paring'].replace("(Curried,Thai,PanAsian)Cheese(sharpBlue,Cheddar)Meat(Game,GrilledMeat)" , "Curried, Thai, PanAsian, Cheese, Meat")
test['Food Paring'] = test['Food Paring'].replace("None,yet" , "None")
test['Food Paring'] = test['Food Paring'].replace("Cheese(tangyBrick,Edam,Feta)" , "Cheese")
test['Food Paring'] = test['Food Paring'].replace("(Barbecue,LatinAmerican)Cheese(earthyCamembert,Fontina)General(Chocolate,Dessert)Meat(Beef,Shellfish,SmokedMeat,GrilledMeat)" , "Barbecue, LatinAmerican, Cheese, General Food, Meat")
test['Food Paring'] = test['Food Paring'].replace("Cheese(sharpBlue,Cheddar,pungentGorgonzola,Limburger,tangyBrick,Edam,Feta)General(Salad)" , "Cheese, General Food")
test['Food Paring'] = test['Food Paring'].replace("(German)Cheese(butteryBrie,Gouda,Havarti,Swiss)General(Salad)Meat(Pork,Fish,Shellfish)" , "German, Cheese, General Food, Meat")
test['Food Paring'] = test['Food Paring'].replace("(Barbecue,Indian,LatinAmerican,Thai,PanAsian)Cheese(pepperyMontereyPepperJack)Meat(Shellfish)" , "Barbecue, Indian, LatinAmerican, Thai, PanAsian, Cheese, Meat")
test['Food Paring'] = test['Food Paring'].replace("(German)General(Salad)Meat(Fish)" , "German, General Food, Meat")
test['Food Paring'] = test['Food Paring'].replace("Cheese(earthyCamembert,Fontina,nuttyAsiago,Colby,Parmesan)Meat(Pork,GrilledMeat)" , "Cheese, Meat")
test['Food Paring'] = test['Food Paring'].replace("(LatinAmerican)Meat(Beef,Poultry)" , "LatinAmerican, Meat")
test['Food Paring'] = test['Food Paring'].replace("(Curried,German)Cheese(nuttyAsiago,Colby,Parmesan)General(Digestive)Meat(Salmon)" , "German, Cheese, General Food, Meat")
test['Food Paring'] = test['Food Paring'].replace("Meat(Pork,Poultry)" , "Meat")
test['Food Paring'] = test['Food Paring'].replace("(Barbecue,LatinAmerican)Cheese(nuttyAsiago,Colby,Parmesan)General(Chocolate)Meat(Salmon)" , "Barbecue, LatinAmerican, Cheese, General Food, Meat")
test['Food Paring'] = test['Food Paring'].replace("(German)General(Chocolate,Dessert)Meat(GrilledMeat)" , "German, General Food, Meat")
test['Food Paring'] = test['Food Paring'].replace("Cheese(earthyCamembert,Fontina)General(Chocolate)Meat(GrilledMeat)" , "Cheese, General Food, Meat")
test['Food Paring'] = test['Food Paring'].replace("(Chocolate,Salad,Dessert,Aperitif)" , "Dessert")
test['Food Paring'] = test['Food Paring'].replace("(LatinAmerican,German)Meat(Beef,SmokedMeat,GrilledMeat)" , "LatinAmerican, German, Meat")
test['Food Paring'] = test['Food Paring'].replace("(Barbecue)Cheese(sharpBlue,Cheddar,pungentGorgonzola,Limburger)Meat(Beef,GrilledMeat)" , "Barbecue, Cheese, Meat")
test['Food Paring'] = test['Food Paring'].replace("Cheese(butteryBrie,Gouda,Havarti,Swiss,pungentGorgonzola,Limburger)General(Dessert,Digestive)Meat(Game)" , "Cheese, General Food, Meat")
test['Food Paring'] = test['Food Paring'].replace("Cheese(sharpBlue,Cheddar,tangyBrick,Edam,Feta)General(Aperitif,Digestive)" , "Cheese, General Food")
test['Food Paring'] = test['Food Paring'].replace("Cheese(butteryBrie,Gouda,Havarti,Swiss,sharpBlue,Cheddar)General(Digestive)Meat(Beef,SmokedMeat,Game)" , "Cheese, General Food, Meat")
test['Food Paring'] = test['Food Paring'].replace("(Barbecue,LatinAmerican)General(Chocolate)Meat(SmokedMeat,GrilledMeat)" , "Barbecue, LatinAmerican, General Food, Meat")
test['Food Paring'] = test['Food Paring'].replace("(Salad)Meat(Poultry,Game)" , "Salad, Meat")
test['Food Paring'] = test['Food Paring'].replace("(German)General(Salad)Meat(Poultry,Fish)" , "German, General Food, Meat")
test['Food Paring'] = test['Food Paring'].replace("Cheese(pungentGorgonzola,Limburger,tangyBrick,Edam,Feta)General(Digestive)Meat(Shellfish,Game,GrilledMeat)" , "Cheese, General Food, Meat")
test['Food Paring'] = test['Food Paring'].replace("(Barbecue)Cheese(pepperyMontereyPepperJack,sharpBlue,Cheddar)Meat(Beef,SmokedMeat,Game,GrilledMeat,Salmon)" , "Barbecue, Cheese, Meat")
test['Food Paring'] = test['Food Paring'].replace("(German)Cheese(sharpBlue,Cheddar)General(Salad)Meat(Pork)" , "German, Cheese, General Food, Meat")
test['Food Paring'] = test['Food Paring'].replace("(Thai,Chinese,Japanese,PanAsian)Meat(Pork,Poultry,Fish,Shellfish)" , "Thai, Chinese, Japanese, PanAsian, Meat")
test['Food Paring'] = test['Food Paring'].replace("(Barbecue,LatinAmerican)Cheese(pepperyMontereyPepperJack)Meat(Fish,SmokedMeat)" , "Barbecue, LatinAmerican, Cheese, Meat")
test['Food Paring'] = test['Food Paring'].replace("Cheese(sharpBlue,Cheddar,pungentGorgonzola,Limburger)General(Aperitif,Digestive)" , "Cheese, General Food")
test['Food Paring'] = test['Food Paring'].replace("(Curried)Cheese(nuttyAsiago,Colby,Parmesan,pepperyMontereyPepperJack)Meat(Poultry,Fish)" , "Curried, Cheese, Meat")
test['Food Paring'] = test['Food Paring'].replace("(German)Cheese(butteryBrie,Gouda,Havarti,Swiss,sharpBlue,Cheddar)General(Dessert,Digestive)" , "German, Cheese, General Food")
test['Food Paring'] = test['Food Paring'].replace("Cheese(earthyCamembert,Fontina,sharpBlue,Cheddar)Meat(GrilledMeat)" , "Cheese, Meat")
test['Food Paring'] = test['Food Paring'].replace("Cheese(butteryBrie,Gouda,Havarti,Swiss,sharpBlue,Cheddar,pungentGorgonzola,Limburger)" , "Cheese")
test['Food Paring'] = test['Food Paring'].replace("(Barbecue,German)Cheese(pepperyMontereyPepperJack,sharpBlue,Cheddar)Meat(Beef,SmokedMeat,Game,GrilledMeat,Salmon)" , "Barbecue, German, Cheese, Meat")
test['Food Paring'] = test['Food Paring'].replace("(Dessert,Aperitif)" , "Dessert")
test['Food Paring'] = test['Food Paring'].replace("(German)Cheese(butteryBrie,Gouda,Havarti,Swiss)General(Aperitif)Meat(Pork,Poultry,Fish,Shellfish)" , "German, Cheese, General Food, Meat")
test['Food Paring'] = test['Food Paring'].replace("(Japanese)" , "Japanese")
test['Food Paring'] = test['Food Paring'].replace("(Aperitif)Meat(Fish,Shellfish,Salmon)" , "Meat")
test['Food Paring'].nunique()
freq = nltk.FreqDist(test['Glassware Used'])
for key,value in freq.items():
    print(str(key)+'  :  '+str(value))
test['Glassware Used'] = test['Glassware Used'].replace("PintGlass(orBecker,Nonic,Tumbler),Mug(orSeidel,Stein)" , "PintGlass, Mug")
test['Glassware Used'] = test['Glassware Used'].replace("Snifter,Tulip,OversizedWineGlass" , "Snifter, Tulip, OversizedWineGlass")
test['Glassware Used'] = test['Glassware Used'].replace("Flute,PilsenerGlass(orPokal),Mug(orSeidel,Stein)" , "Flute, PilsenerGlass, Mug")
test['Glassware Used'] = test['Glassware Used'].replace("PintGlass(orBecker,Nonic,Tumbler),Snifter,OversizedWineGlass" , "PintGlass, Snifter, OversizedWineGlass")
test['Glassware Used'] = test['Glassware Used'].replace("PilsenerGlass(orPokal" , "PilsenerGlass")
test['Glassware Used'] = test['Glassware Used'].replace("Flute,Tulip,OversizedWineGlass" , "Flute, Tulip, OversizedWineGlass")
test['Glassware Used'] = test['Glassware Used'].replace("PintGlass(orBecker,Nonic,Tumbler)" , "PintGlass")
test['Glassware Used'] = test['Glassware Used'].replace("PintGlass(orBecker,Nonic,Tumbler),Tulip,OversizedWineGlass" , "PintGlass, Tulip, OversizedWineGlass") 
test['Glassware Used'] = test['Glassware Used'].replace("Flute,PilsenerGlass(orPokal),Mug(orSeidel,Stein),Stange(SlenderCylinder)" , "Flute, PilsenerGlass, Mug, Stange")
test['Glassware Used'] = test['Glassware Used'].replace("PintGlass(orBecker,Nonic,Tumbler),Snifter" , "PintGlass, Snifter")
test['Glassware Used'] = test['Glassware Used'].replace("PintGlass(orBecker,Nonic,Tumbler),PilsenerGlass(orPokal),Mug(orSeidel,Stein)" , "PintGlass, PilsenerGlass, Mug")
test['Glassware Used'] = test['Glassware Used'].replace("Mug(orSeidel,Stein)" , "Mug")
test['Glassware Used'] = test['Glassware Used'].replace("PilsenerGlass(orPokal),Mug(orSeidel,Stein)" , "PilsenerGlass, Mug")
test['Glassware Used'] = test['Glassware Used'].replace("Stange(SlenderCylinder)" , "Stange")
test['Glassware Used'] = test['Glassware Used'].replace("Goblet(orChalice)" , "Goblet")
test['Glassware Used'] = test['Glassware Used'].replace("PintGlass(orBecker,Nonic,Tumbler),Snifter,Mug(orSeidel,Stein)","PintGlass, Snifter, Mug") 
test['Glassware Used'] = test['Glassware Used'].replace("PintGlass(orBecker,Nonic,Tumbler),Goblet(orChalice)" , "PintGlass, Goblet")
test['Glassware Used'] = test['Glassware Used'].replace("WeizenGlass" , "WeizenGlass")
test['Glassware Used'] = test['Glassware Used'].replace("Tulip,OversizedWineGlass" , "Tulip, OversizedWineGlass")
test['Glassware Used'] = test['Glassware Used'].replace("Flute,PilsenerGlass(orPokal)" , "Flute, PilsenerGlass")
test['Glassware Used'] = test['Glassware Used'].replace("PintGlass(orBecker,Nonic,Tumbler),Snifter,Tulip" , "PintGlass, Snifter, Tulip")
test['Glassware Used'] = test['Glassware Used'].replace("Snifter,Goblet(orChalice)" , "Snifter, Goblet")
test['Glassware Used'] = test['Glassware Used'].replace("PintGlass(orBecker,Nonic,Tumbler),Stange(SlenderCylinder)" , "PintGlass, Stange")
test['Glassware Used'] = test['Glassware Used'].replace("Tulip,Goblet(orChalice),OversizedWineGlass" , "Tulip, Goblet, OversizedWineGlass")
test['Glassware Used'] = test['Glassware Used'].replace("PintGlass(orBecker,Nonic,Tumbler),PilsenerGlass(orPokal)" , "PintGlass, PilsenerGlass")
test['Glassware Used'] = test['Glassware Used'].replace("Stange(SlenderCylinder),WeizenGlass" , "Stange, WeizenGlass")
test['Glassware Used'] = test['Glassware Used'].replace("PintGlass(orBecker,Nonic,Tumbler),Mug(orSeidel,Stein),WeizenGlass" , "PintGlass, Mug, WeizenGlass")
test['Glassware Used'] = test['Glassware Used'].replace("PintGlass(orBecker,Nonic,Tumbler),Mug(orSeidel,Stein),OversizedWineGlass" , "PintGlass, Mug, OversizedWineGlass")
test['Glassware Used'] = test['Glassware Used'].replace("Flute,WeizenGlass" , "Flute, WeizenGlass")
test['Glassware Used'] = test['Glassware Used'].replace("Flute,Snifter,Tulip" , "Flute, Snifter, Tulip")
test['Glassware Used'] = test['Glassware Used'].replace("Flute,Snifter,Tulip,Stange(SlenderCylinder)" , "Flute, Snifter, Tulip, Stange")
test['Glassware Used'] = test['Glassware Used'].replace("Snifter,Tulip,Goblet(orChalice),OversizedWineGlass" , "Snifter, Tulip, Goblet, OversizedWineGlass")
test['Glassware Used'] = test['Glassware Used'].replace("Snifter,OversizedWineGlass" , "Snifter, OversizedWineGlass")
test['Glassware Used'] = test['Glassware Used'].replace("Snifter,Tulip,Goblet(orChalice)" , "Snifter, Tulip, Goblet")
test['Glassware Used'] = test['Glassware Used'].replace("None,yet" , "None")
test['Glassware Used'] = test['Glassware Used'].replace("Flute,Stange(SlenderCylinder)" , "Flute,Stange")
test['Glassware Used'] = test['Glassware Used'].replace("Flute,Snifter,OversizedWineGlass" , "Flute, Snifter, OversizedWineGlass")
test['Glassware Used'] = test['Glassware Used'].replace("Mug(orSeidel,Stein),Stange(SlenderCylinder)" , "Mug, Stange")
test['Glassware Used'] = test['Glassware Used'].replace("Flute" , "Flute")

test['Glassware Used'].nunique()
test.dtypes
test['Food Paring label']= label_encoder.fit_transform(test['Food Paring']) 
test['Glassware Used label']= label_encoder.fit_transform(test['Glassware Used']) 
test['Style Name label']= label_encoder.fit_transform(test['Style Name']) 
test['Ratings'] = pd.to_numeric(test['Ratings'],errors='coerce')
test['Beer Name'] = test['Beer Name'].astype(float)
test['Brewing Company'] = test['Brewing Company'].astype(float)
test.isnull().sum()
test_avg_ratings = test['Ratings'].astype(float).mean()
test['Ratings'].replace(np.nan, test_avg_ratings, inplace=True)
test.isnull().sum()
test.columns
test1 = test[['ABV', 'Ratings', 'Minimum Temperature', 'Maximum Temperature','Minimum Serving Temperature', 'Maximum Serving Temperature', 'Food Paring label', 'Glassware Used label', 'Style Name label']]
test1.isnull().sum()<jupyter_output><empty_output><jupyter_text>Data Pre-Processing<jupyter_code>x = train1.iloc[:,:-1]
y = train1.iloc[:,-1]
print(x.columns)

from sklearn.preprocessing import StandardScaler
x = StandardScaler().fit(x).transform(x)
x[:3]<jupyter_output><empty_output><jupyter_text>Regression<jupyter_code>from sklearn.model_selection import train_test_split

x_train, x_test, y_train, y_test = train_test_split(x, y, random_state = 0)
from sklearn.linear_model import LinearRegression
reg = LinearRegression()
reg.fit(x_train, y_train)
y_pred = reg.predict(x_test)
print(y_pred)
# Calculating score from Root Mean Log Squared Error
def rmlse(y_test, y_pred):
    error = np.square(np.log10(y_pred +1) - np.log10(y_test +1)).mean() ** 0.5
    score = 1 - error
    return score

print("\n----------------------------\nRMLSE Score = ", rmlse(y_test, y_pred))<jupyter_output>----------------------------
RMLSE Score =  0.7615472587302806<jupyter_text>SVR<jupyter_code>from sklearn.svm import SVR
svr = SVR(kernel='rbf')
# Training the regressor with training data
svr.fit(x_train, y_train)
y_pred2 = svr.predict(x_test)
print(y_pred2)
print("----------------------------\nRMLSE Score = ", rmlse(y_test, y_pred2))
pd.DataFrame({'Score' : y_pred}).to_excel("C:\\Users\\Moaz\\Desktop\\moaz\\Jupyter Python NB\\Machine Hack\\beer_score.xlsx")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18057615388072445, 'fraction_numerical': 0.0024268572199002292, 'mean_word_length': 11.578858111927643, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '6234', 'license': 'MIT', 'n_tokens_mistral': 8694, 'n_tokens_neox': 8041, 'n_words': 1133, 'path': 'Predict Beer .ipynb', 'repo_name': 'MOAZ47/Predict-the-score-of-Beer', 'size': '22251'}