├── planets_name.csv
├── emirhan_project_planet_classifier0.png
├── emirhan_project_planet_classifier1.png
├── emirhan_project_planet_classifier2.png
├── emirhan_project_planet_classifier3.png
├── emirhan_project_planet_classifier4.png
├── emirhan_project_planet_classifier5.png
├── emirhan_project_planet_regressor0.png
├── emirhan_project_planet_regressor1.png
├── emirhan_project_planet_regressor2.png
├── emirhan_project_planet_regressor3.png
├── emirhan_project_planet_regressor4.png
├── emirhan_project_planet_regressor5.png
├── planets_large_data.csv
├── LICENSE
├── .gitignore
├── README.md
└── planet_prediction.py
/planets_name.csv:
--------------------------------------------------------------------------------
1 | Earth,Jupiter,Mars,Mercury,Neptune,Saturn,Uranus,Venus
2 |
--------------------------------------------------------------------------------
/emirhan_project_planet_classifier0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emirhanai/Machine-Learning-Software-that-predicts-planets-based-on-their-distance-from-the-sun-number-of-sate/HEAD/emirhan_project_planet_classifier0.png
--------------------------------------------------------------------------------
/emirhan_project_planet_classifier1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emirhanai/Machine-Learning-Software-that-predicts-planets-based-on-their-distance-from-the-sun-number-of-sate/HEAD/emirhan_project_planet_classifier1.png
--------------------------------------------------------------------------------
/emirhan_project_planet_classifier2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emirhanai/Machine-Learning-Software-that-predicts-planets-based-on-their-distance-from-the-sun-number-of-sate/HEAD/emirhan_project_planet_classifier2.png
--------------------------------------------------------------------------------
/emirhan_project_planet_classifier3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emirhanai/Machine-Learning-Software-that-predicts-planets-based-on-their-distance-from-the-sun-number-of-sate/HEAD/emirhan_project_planet_classifier3.png
--------------------------------------------------------------------------------
/emirhan_project_planet_classifier4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emirhanai/Machine-Learning-Software-that-predicts-planets-based-on-their-distance-from-the-sun-number-of-sate/HEAD/emirhan_project_planet_classifier4.png
--------------------------------------------------------------------------------
/emirhan_project_planet_classifier5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emirhanai/Machine-Learning-Software-that-predicts-planets-based-on-their-distance-from-the-sun-number-of-sate/HEAD/emirhan_project_planet_classifier5.png
--------------------------------------------------------------------------------
/emirhan_project_planet_regressor0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emirhanai/Machine-Learning-Software-that-predicts-planets-based-on-their-distance-from-the-sun-number-of-sate/HEAD/emirhan_project_planet_regressor0.png
--------------------------------------------------------------------------------
/emirhan_project_planet_regressor1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emirhanai/Machine-Learning-Software-that-predicts-planets-based-on-their-distance-from-the-sun-number-of-sate/HEAD/emirhan_project_planet_regressor1.png
--------------------------------------------------------------------------------
/emirhan_project_planet_regressor2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emirhanai/Machine-Learning-Software-that-predicts-planets-based-on-their-distance-from-the-sun-number-of-sate/HEAD/emirhan_project_planet_regressor2.png
--------------------------------------------------------------------------------
/emirhan_project_planet_regressor3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emirhanai/Machine-Learning-Software-that-predicts-planets-based-on-their-distance-from-the-sun-number-of-sate/HEAD/emirhan_project_planet_regressor3.png
--------------------------------------------------------------------------------
/emirhan_project_planet_regressor4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emirhanai/Machine-Learning-Software-that-predicts-planets-based-on-their-distance-from-the-sun-number-of-sate/HEAD/emirhan_project_planet_regressor4.png
--------------------------------------------------------------------------------
/emirhan_project_planet_regressor5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emirhanai/Machine-Learning-Software-that-predicts-planets-based-on-their-distance-from-the-sun-number-of-sate/HEAD/emirhan_project_planet_regressor5.png
--------------------------------------------------------------------------------
/planets_large_data.csv:
--------------------------------------------------------------------------------
1 | Planet,Distance From The Sun,Confirmed Moons,Provisional Moons,Total Moons,(Volume/1000000000-cubic km),Diameter of Planet(km)
2 | Mercury,57910000,0,0,0,60,4884
3 | Venus,108200000,0,0,0,928,12342
4 | Earth,149600000,1,0,1,1083,12735
5 | Mars,227900000,2,0,2,163,6767
6 | Jupiter,778500000,53,26,79,1431280,142324
7 | Saturn,1434000900,53,29,81,827130,124832
8 | Uranus,2871000900,27,0,27,68330,51726
9 | Neptune,4495000900,14,0,14,62540,49243
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Emirhan BULUT
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | build/
12 | develop-eggs/
13 | dist/
14 | downloads/
15 | eggs/
16 | .eggs/
17 | lib/
18 | lib64/
19 | parts/
20 | sdist/
21 | var/
22 | wheels/
23 | pip-wheel-metadata/
24 | share/python-wheels/
25 | *.egg-info/
26 | .installed.cfg
27 | *.egg
28 | MANIFEST
29 |
30 | # PyInstaller
31 | # Usually these files are written by a python script from a template
32 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
33 | *.manifest
34 | *.spec
35 |
36 | # Installer logs
37 | pip-log.txt
38 | pip-delete-this-directory.txt
39 |
40 | # Unit test / coverage reports
41 | htmlcov/
42 | .tox/
43 | .nox/
44 | .coverage
45 | .coverage.*
46 | .cache
47 | nosetests.xml
48 | coverage.xml
49 | *.cover
50 | *.py,cover
51 | .hypothesis/
52 | .pytest_cache/
53 |
54 | # Translations
55 | *.mo
56 | *.pot
57 |
58 | # Django stuff:
59 | *.log
60 | local_settings.py
61 | db.sqlite3
62 | db.sqlite3-journal
63 |
64 | # Flask stuff:
65 | instance/
66 | .webassets-cache
67 |
68 | # Scrapy stuff:
69 | .scrapy
70 |
71 | # Sphinx documentation
72 | docs/_build/
73 |
74 | # PyBuilder
75 | target/
76 |
77 | # Jupyter Notebook
78 | .ipynb_checkpoints
79 |
80 | # IPython
81 | profile_default/
82 | ipython_config.py
83 |
84 | # pyenv
85 | .python-version
86 |
87 | # pipenv
88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies
90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not
91 | # install all needed dependencies.
92 | #Pipfile.lock
93 |
94 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow
95 | __pypackages__/
96 |
97 | # Celery stuff
98 | celerybeat-schedule
99 | celerybeat.pid
100 |
101 | # SageMath parsed files
102 | *.sage.py
103 |
104 | # Environments
105 | .env
106 | .venv
107 | env/
108 | venv/
109 | ENV/
110 | env.bak/
111 | venv.bak/
112 |
113 | # Spyder project settings
114 | .spyderproject
115 | .spyproject
116 |
117 | # Rope project settings
118 | .ropeproject
119 |
120 | # mkdocs documentation
121 | /site
122 |
123 | # mypy
124 | .mypy_cache/
125 | .dmypy.json
126 | dmypy.json
127 |
128 | # Pyre type checker
129 | .pyre/
130 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # **Machine Learning Software that predicts planets based on their distance from the sun, number of satellites and various properties**
2 | 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.
3 |
4 | The values you enter should be (respectively):
5 |
6 | **1) Enter to Distance From The Sun**
7 |
8 | **2) Enter to Confirmed Moons**
9 |
10 | **3) Enter to Provisional Moons**
11 |
12 | **4) Enter to Total Moons**
13 |
14 | **5) Enter to Volume (Enter the state / 1.000.000.000) - Cubic (km)**
15 |
16 | **6) Enter to Diameter Of Planet (km)**
17 |
18 |
19 | _Example:_ `model_run = model.predict([[Distance_From_The_Sun,Confirmed_Moons, Provisional_Moons, Total_Moons, Volume_1000000000_cubic_km, Diameter_of_Planet_km]])`
20 |
21 | _Outpot :_ `Predicted Planet: ['Mercury']`
22 |
23 | **I am happy to present this software to you!**
24 |
25 | Data Source: [DataSource] , [DataSource1]
26 | ###**The coding language used:**
27 |
28 | `Python 3.9.6`
29 |
30 | ###**Libraries Used:**
31 |
32 | `Sklearn`
33 |
34 | `Pandas`
35 |
36 | ### **Developer Information:**
37 |
38 | Name-Surname: **Emirhan BULUT**
39 |
40 | Contact (Email) : **emirhan.bulut@turkiyeyapayzeka.com**
41 |
42 | LinkedIn : **[https://www.linkedin.com/in/artificialintelligencebulut/][LinkedinAccount]**
43 |
44 | [LinkedinAccount]: https://www.linkedin.com/in/artificialintelligencebulut/
45 |
46 | Official Website: **[https://www.emirhanbulut.com.tr][OfficialWebSite]**
47 |
48 | [OfficialWebSite]: https://www.emirhanbulut.com.tr
49 |
50 | [DataSource]: https://www.nasa.gov/
51 |
52 | [DataSource1]: https://en.wikipedia.org/wiki/Main_Page
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/planet_prediction.py:
--------------------------------------------------------------------------------
1 | from sklearn.preprocessing import LabelEncoder
2 | from sklearn.ensemble import RandomForestClassifier
3 | from sklearn.ensemble import RandomForestRegressor
4 | from sklearn.tree import export_graphviz
5 | import pandas as pd
6 |
7 | def save_decision_trees_as_dot(clf, iteration, feature_name, target_name):
8 | file_name = open("emirhan_project_planet" + str(iteration) + ".dot",'w')
9 | dot_data = export_graphviz(
10 | clf,
11 | out_file=file_name,
12 | feature_names=feature_name,
13 | class_names=target_name,
14 | rounded=True,
15 | proportion=False,
16 | precision=2,
17 | filled=True,)
18 | file_name.close()
19 | print("Decision Tree in forest :) {} saved as dot file".format(iteration + 1))
20 |
21 |
22 | df = pd.read_csv('planets_large_data.csv')
23 |
24 | X= df.drop(['Planet'], axis = 'columns')
25 | #print(X)
26 | y= df.drop(['Distance From The Sun','Confirmed Moons','Provisional Moons','Total Moons','(Volume/1000000000-cubic km)','Diameter of Planet(km)'], axis= 'columns')
27 | #print(y)
28 |
29 | y_data = LabelEncoder()
30 | #LabelEncoder() function :))
31 |
32 | y['Planet_Data'] = y_data.fit_transform(y['Planet'])
33 | # Planet Columns value change to Planet_Data with fit_transform function
34 |
35 | #print(connects)
36 |
37 | y_n = y.drop(['Planet'],axis='columns')
38 | #New Columns of Target :))
39 |
40 | # In additionnn: print(y_n)
41 |
42 |
43 | feature_names = X.columns
44 | #a few fetaure names..
45 |
46 | target_names = y_n.columns
47 | # one of the columns is target name :)
48 |
49 | model = RandomForestClassifier(n_estimators=1)
50 |
51 | # our model like to above :)
52 |
53 | model.fit(X,y_n)
54 | #our model training to the above...
55 |
56 | #print(model.estimators_[2])
57 |
58 | #The collection of fitted sub-estimators = estimators_
59 |
60 | for i in range(len(model.estimators_)):
61 | save_decision_trees_as_dot(model.estimators_[i], i, feature_names, target_names)
62 | print(i)
63 |
64 |
65 | #prediction is the PLANET!
66 |
67 |
68 | Distance_From_The_Sun = int(input("Enter to Distance From The Sun: "))
69 | Confirmed_Moons = int(input("Enter to Confirmed Moons: "))
70 | Provisional_Moons = int(input("Enter to Provisional Moons: "))
71 | Total_Moons = int(input("Enter to Total Moons: "))
72 | Volume_1000000000_cubic_km = int(input("Enter to Volume (Enter the state / 1.000.000.000) - Cubic (km) : "))
73 | Diameter_of_Planet_km = int(input("Enter to Diameter Of Planet (km): "))
74 |
75 | try:
76 | while True:
77 | model_run = model.predict([[Distance_From_The_Sun,Confirmed_Moons, Provisional_Moons, Total_Moons, Volume_1000000000_cubic_km, Diameter_of_Planet_km]])
78 | planets = pd.read_csv('planets_name.csv',index_col=None, na_values=None)
79 | planet_detect_algorithm = planets.columns.values[model_run]
80 | print("Predicted Planet: {}".format(planet_detect_algorithm))
81 | break
82 |
83 | except:
84 | print("Try again!")
85 | #print(model.predict([[predict_2014,predict_2020,predict_population]]))
86 |
--------------------------------------------------------------------------------