Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Machine Learning Software that predicts planet
Machine Learning Software that predicts planets based on their distance from the sun, number of satellites and various properties I developed Machine Learning Software that predicts planets based on their distance from the sun, number of satellites and various properties. This machine learning software is based on Random Forest Classifier and Random Forest Regression. Based on the principles of Supervised Learning, machine learning software predicts planets by their distance from the sun, Confirmed Moons, Provisional Moons, Total Moons, Volume (cubic kilometers) and planet's diameter.
- Loading branch information
Showing
16 changed files
with
147 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,52 @@ | ||
# Machine-Learning-Software-that-predicts-planets-based-on-their-distance-from-the-sun-number-of-sate | ||
Machine Learning Software that predicts planets based on their distance from the sun, number of satellites and various properties | ||
# **Machine Learning Software that predicts planets based on their distance from the sun, number of satellites and various properties** | ||
I developed Machine Learning Software that predicts planets based on their distance from the sun, number of satellites and various properties. This machine learning software is based on Random Forest Classifier and Random Forest Regression. Based on the principles of Supervised Learning, machine learning software predicts planets by their distance from the sun, Confirmed Moons, Provisional Moons, Total Moons, Volume (cubic kilometers) and planet's diameter. | ||
|
||
The values you enter should be (respectively): | ||
|
||
**1) Enter to Distance From The Sun** | ||
|
||
**2) Enter to Confirmed Moons** | ||
|
||
**3) Enter to Provisional Moons** | ||
|
||
**4) Enter to Total Moons** | ||
|
||
**5) Enter to Volume (Enter the state / 1.000.000.000) - Cubic (km)** | ||
|
||
**6) Enter to Diameter Of Planet (km)** | ||
|
||
|
||
_Example:_ `model_run = model.predict([[Distance_From_The_Sun,Confirmed_Moons, Provisional_Moons, Total_Moons, Volume_1000000000_cubic_km, Diameter_of_Planet_km]])` | ||
|
||
_Outpot :_ `Predicted Planet: ['Mercury']` | ||
|
||
**I am happy to present this software to you!** | ||
|
||
Data Source: [DataSource] , [DataSource1] | ||
###**The coding language used:** | ||
|
||
`Python 3.9.6` | ||
|
||
###**Libraries Used:** | ||
|
||
`Sklearn` | ||
|
||
`Pandas` | ||
|
||
### **Developer Information:** | ||
|
||
Name-Surname: **Emirhan BULUT** | ||
|
||
Contact (Email) : **emirhan.bulut@turkiyeyapayzeka.com** | ||
|
||
LinkedIn : **[https://www.linkedin.com/in/artificialintelligencebulut/][LinkedinAccount]** | ||
|
||
[LinkedinAccount]: https://www.linkedin.com/in/artificialintelligencebulut/ | ||
|
||
Official Website: **[https://www.emirhanbulut.com.tr][OfficialWebSite]** | ||
|
||
[OfficialWebSite]: https://www.emirhanbulut.com.tr | ||
|
||
[DataSource]: https://www.nasa.gov/ | ||
|
||
[DataSource1]: https://en.wikipedia.org/wiki/Main_Page |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
from sklearn.preprocessing import LabelEncoder | ||
from sklearn.ensemble import RandomForestClassifier | ||
from sklearn.ensemble import RandomForestRegressor | ||
from sklearn.tree import export_graphviz | ||
import pandas as pd | ||
|
||
def save_decision_trees_as_dot(clf, iteration, feature_name, target_name): | ||
file_name = open("emirhan_project_planet" + str(iteration) + ".dot",'w') | ||
dot_data = export_graphviz( | ||
clf, | ||
out_file=file_name, | ||
feature_names=feature_name, | ||
class_names=target_name, | ||
rounded=True, | ||
proportion=False, | ||
precision=2, | ||
filled=True,) | ||
file_name.close() | ||
print("Decision Tree in forest :) {} saved as dot file".format(iteration + 1)) | ||
|
||
|
||
df = pd.read_csv('planets_large_data.csv') | ||
|
||
X= df.drop(['Planet'], axis = 'columns') | ||
#print(X) | ||
y= df.drop(['Distance From The Sun','Confirmed Moons','Provisional Moons','Total Moons','(Volume/1000000000-cubic km)','Diameter of Planet(km)'], axis= 'columns') | ||
#print(y) | ||
|
||
y_data = LabelEncoder() | ||
#LabelEncoder() function :)) | ||
|
||
y['Planet_Data'] = y_data.fit_transform(y['Planet']) | ||
# Planet Columns value change to Planet_Data with fit_transform function | ||
|
||
#print(connects) | ||
|
||
y_n = y.drop(['Planet'],axis='columns') | ||
#New Columns of Target :)) | ||
|
||
# In additionnn: print(y_n) | ||
|
||
|
||
feature_names = X.columns | ||
#a few fetaure names.. | ||
|
||
target_names = y_n.columns | ||
# one of the columns is target name :) | ||
|
||
model = RandomForestClassifier(n_estimators=1) | ||
|
||
# our model like to above :) | ||
|
||
model.fit(X,y_n) | ||
#our model training to the above... | ||
|
||
#print(model.estimators_[2]) | ||
|
||
#The collection of fitted sub-estimators = estimators_ | ||
|
||
for i in range(len(model.estimators_)): | ||
save_decision_trees_as_dot(model.estimators_[i], i, feature_names, target_names) | ||
print(i) | ||
|
||
|
||
#prediction is the PLANET! | ||
|
||
|
||
Distance_From_The_Sun = int(input("Enter to Distance From The Sun: ")) | ||
Confirmed_Moons = int(input("Enter to Confirmed Moons: ")) | ||
Provisional_Moons = int(input("Enter to Provisional Moons: ")) | ||
Total_Moons = int(input("Enter to Total Moons: ")) | ||
Volume_1000000000_cubic_km = int(input("Enter to Volume (Enter the state / 1.000.000.000) - Cubic (km) : ")) | ||
Diameter_of_Planet_km = int(input("Enter to Diameter Of Planet (km): ")) | ||
|
||
try: | ||
while True: | ||
model_run = model.predict([[Distance_From_The_Sun,Confirmed_Moons, Provisional_Moons, Total_Moons, Volume_1000000000_cubic_km, Diameter_of_Planet_km]]) | ||
planets = pd.read_csv('planets_name.csv',index_col=None, na_values=None) | ||
planet_detect_algorithm = planets.columns.values[model_run] | ||
print("Predicted Planet: {}".format(planet_detect_algorithm)) | ||
break | ||
|
||
except: | ||
print("Try again!") | ||
#print(model.predict([[predict_2014,predict_2020,predict_population]])) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Planet,Distance From The Sun,Confirmed Moons,Provisional Moons,Total Moons,(Volume/1000000000-cubic km),Diameter of Planet(km) | ||
Mercury,57910000,0,0,0,60,4884 | ||
Venus,108200000,0,0,0,928,12342 | ||
Earth,149600000,1,0,1,1083,12735 | ||
Mars,227900000,2,0,2,163,6767 | ||
Jupiter,778500000,53,26,79,1431280,142324 | ||
Saturn,1434000900,53,29,81,827130,124832 | ||
Uranus,2871000900,27,0,27,68330,51726 | ||
Neptune,4495000900,14,0,14,62540,49243 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Earth,Jupiter,Mars,Mercury,Neptune,Saturn,Uranus,Venus |