NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

Machine Learning in Rocket Launch: Your Mission Awaits
πŸš€ Mission Briefing πŸš€

Greetings, aspiring Mission Director!

Welcome to the heart of ISRO's operations. Today, with wings!!!; you are the Mission Director for one of our most pivotal projects. As you embark on this journey, you'll delve into the intricate interplay between rocket science and machine learning. Have you ever pondered the complexities behind launching a rocket into the cosmos? It's more than just a countdown; it's a responsibility, and today, that responsibility is yours.

Our planet's atmosphere, while a protective shield for us, presents a labyrinth of challenges for a rocket. From the moment of ignition to its majestic ascent into space, the rocket is at the mercy of ever-changing weather conditions, which can alter its trajectory and speed. This is where your expertise in machine learning will be invaluable.

Your task is monumental. You must harness the power of machine learning to predict the most opportune moments for a launch. The stakes? Astronomically high. The weather conditions must align perfectly to ensure the rocket's safe passage. While launching closer to the equator is ideal, the atmospheric conditions cannot be overlooked. And if circumstances demand an abort, the rocket must be over vast waters.

Your mission base? Sriharikota, a strategic location in Andhra Pradesh. At first glance, with its high humidity, cyclones, and heavy rains, it might seem an unconventional choice. Some might even wonder, "Why not the stable deserts of Rajasthan?" But the space exploration is all about precision. Despite its challenges, Sriharikota provides the trajectory essential for our rockets.

So, Mission Director, as you undertake this mission, we urge you to dive deep, question every detail, and unravel how machine learning can be the linchpin in our space endeavors. The fusion of machine learning and rocket science awaits your command. Are you prepared to lead this mission to success? The countdown begins now.

!!! IMP Note: Use random seed value = 42

nasa_rocket_launch_data
## Dataset:
​
Nasa data : "nasa_rocket_launch_data.csv"
ISRO data : "isro_rocket_launch_data.csv"
import pandas as pd
nasa_df = pd.read_csv("nasa_rocket_launch_data.csv")
nasa_df
​
# Read the nasa_rocket_launch_data.csv file
​
Name Date Time (East Coast) Location Crewed or Uncrewed Launched? High Temp Low Temp Ave Temp Temp at Launch Time ... Max Wind Speed Visibility Wind Speed at Launch Time Hist Ave Max Wind Speed Hist Ave Visibility Sea Level Pressure Hist Ave Sea Level Pressure Day Length Condition Notes
0 NaN 1958-12-04 00:00:00 NaN Cape Canaveral NaN NaN 75.0 68.0 71.00 NaN ... 16.0 15.0 NaN NaN NaN 30.22 NaN 10:26:00 Cloudy NaN
1 NaN 1958-12-05 00:00:00 NaN Cape Canaveral NaN NaN 78.0 70.0 73.39 NaN ... 14.0 10.0 NaN NaN NaN 30.2 NaN 10:26:00 Cloudy NaN
2 Pioneer 3 1958-12-06 00:00:00 01:45:00 Cape Canaveral Uncrewed Y 73.0 0.0 60.21 62.0 ... 15.0 10.0 11.0 NaN NaN 30.25 NaN 10:25:00 Cloudy NaN
3 NaN 1958-12-07 00:00:00 NaN Cape Canaveral NaN NaN 76.0 57.0 66.04 NaN ... 10.0 10.0 NaN NaN NaN 30.28 NaN 10:25:00 Partly Cloudy NaN
4 NaN 1958-12-08 00:00:00 NaN Cape Canaveral NaN NaN 79.0 60.0 70.52 NaN ... 12.0 10.0 NaN NaN NaN 30.23 NaN 12:24:00 Partly Cloudy NaN
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
595 Rocket_295 2023-07-24 18:55 Kourou Crewed N 96.0 47.0 71.50 58.0 ... 21.0 10.0 20.0 NaN 1.0 1046 1042.0 11:10 Cloudy Sample note 295
596 Rocket_296 2023-01-14 17:28 Cape Canaveral Uncrewed Y 99.0 14.0 56.50 77.0 ... 69.0 3.0 4.0 NaN 8.0 1001 1007.0 14:25 Snowy Sample note 296
597 Rocket_297 2023-03-27 12:07 Vandenberg AFB Uncrewed Y 83.0 18.0 50.50 46.0 ... 77.0 3.0 61.0 NaN 6.0 994 992.0 14:19 Cloudy Sample note 297
598 Rocket_298 2023-02-18 06:17 Baikonur Cosmodrome Crewed Y 76.0 8.0 42.00 11.0 ... 77.0 1.0 2.0 NaN 8.0 1032 1025.0 10:47 Foggy Sample note 298
599 Rocket_299 2023-02-08 18:36 Baikonur Cosmodrome Uncrewed N 79.0 40.0 59.50 72.0 ... 20.0 8.0 2.0 NaN 8.0 1026 1044.0 13:13 Cloudy Sample note 299
600 rows × 26 columns

Task 1: Data Exploration and Preprocessing
πŸš€ Mission Briefing πŸš€

Begin by exploring the dataset. Identify any missing values, outliers, or anomalies in the data. Clean the dataset by handling these issues and prepare it for further analysis.

# Data Exploration
​
​
# Check for missing values
​
Task 2: Pre-Launch Preparations - Data Cleaning
πŸš€ Mission Briefing πŸš€

As we prepare for our next rocket launch, we have encountered a challenge that requires your expertise. Our data analysts have provided us with a dataset containing crucial weather conditions for previous rocket launches. However, the dataset is not in its best shape and needs some cleaning and preprocessing before we can use it for our mission analysis.

Your task is to clean and preprocess this dataset to ensure that it's ready for further analysis. The fate of our next rocket launch depends on the accuracy and reliability of this data!

πŸ” Task Details πŸ”

Data Cleaning: Handle any missing values in the dataset. For the columns 'Launched?', 'Crewed or Uncrewed', 'Wind Direction', and 'Condition', use appropriate strategies to fill in the missing values. For all other columns, fill missing values with 0.

Data Transformation: Convert the text data in the columns 'Crewed or Uncrewed', 'Wind Direction', and 'Condition' to numerical values using label encoding.

Data Inspection: Display the first few rows of the cleaned dataset to inspect your work.

# Code
​
​
# Handle missing values
​
​
# Convert text data to numerical
​
​
# Display the first few rows of the cleaned dataset
​
Provide a copy of the dataframe to the q1 variable
q1 = ###
πŸ§ͺ Testing Your Solution πŸ§ͺ

Once you've completed the coding task, run the tests provided below to check the correctness of your solution. If your solution is incorrect, the tests will provide suggestions on how to improve your code.

################ Don't edit or delete the cell, Run this cell to test your code ################
try:
from test_space import space_mod
space_mod.save_ans1(q1)
except:
print("Please check if the variable to the question has been assigned properly")
Task 3: Features Selection: Weather Analysis
πŸš€ Mission Briefing πŸš€

You have successfully cleaned and preprocessed the rocket launch dataset. Now, we are moving to the next crucial phase of our mission: Machine Learning Model Preparation!

Before we can train our machine learning model, we need to determine which columns (features) from our dataset are relevant for predicting rocket launches. Your expertise is required to select the most relevant features that will be fed into our machine learning algorithm.

Your mission is to determine the columns to include in our machine learning model. This will set the foundation for our predictive analysis.

πŸ” Task Details πŸ”

Output Selection: Save the 'Launched?' column as the output variable y, type: pandas's series.

Feature Selection: Remove the columns that are not relevant for our machine learning model. The columns to be removed are provided:

"['Name','Date','Time (East Coast)','Location','Launched?','Hist Ave Sea Level Pressure','Sea Level Pressure','Day Length','Notes','Hist Ave Visibility', 'Hist Ave Max Wind Speed']".
Input Data: Save the remaining columns as the input data X, type: pandas's dataframe.

Feature Inspection: List the columns that will be used as features in our machine learning model.

# Code
​
​
​
​
Assign X and y values to the q2 variable as [X, y]
q2 = ###
πŸ§ͺ Testing Your Solution πŸ§ͺ

After completing the coding task, run the tests provided below to verify the correctness of your solution. If your solution is incorrect, the tests will provide feedback on how to refine your code.

################ Don't edit or delete the cell, Run this cell to test your code ################
try:
from test_space import space_mod
space_mod.save_ans2(q2)
except:
print("Please check if the variable to the question has been assigned properly")
Task 4 - Model Training : NASA Dataset
πŸš€ Mission Briefing πŸš€

Having determined the relevant features for our machine learning model, we are now ready to train our predictive models. This is a critical phase of our mission. The success of our rocket launches depends on the accuracy and reliability of these models.

Your mission is to train two machine learning models: Logistic Regression and Decision Tree on the complete rocket launch dataset: "nasa_rocket_launch_data.csv".

πŸ” Task Details πŸ”

Data Splitting: Split the data into training and testing sets for both the complete dataset and the ISRO dataset.

Model Training: Train Logistic Regression and Decision Tree models on the complete dataset.

Model Evaluation: Evaluate the models on the test set of the complete dataset and note down their accuracies.

πŸ›  Coding Task πŸ› 

Use the provided code template to complete this task.

# Code
​
​
​
​
Store X_test, the model and their predictions in the respective manner and assign to q3.
"q3 = [X_test, model_1 , model_1_pred, model_2 , model_2_pred]"
q3 = ###
πŸ§ͺ Testing Your Solution πŸ§ͺ

After completing the coding task, run the tests provided below to verify the correctness of your solution. If your solution is incorrect, the tests will provide feedback on how to refine your code.

################ Don't edit or delete the cell, Run this cell to test your code ################
try:
from test_space import space_mod
space_mod.save_ans3(q3)
except:
print("Please check if the variable to the question has been assigned properly")
Task 5 : Improve Accuracy with ISRO Dataset
πŸš€ Mission Briefing πŸš€

Welcome again, Mission Director!

Now that we have trained our models on the NASA dataset, it's time to harness the power of Data. We will additionally use ISRO dataset to improve accuracy of our models. This will allow us to leverage the power of data and apply it to the specific conditions of ISRO rocket launches.

Your mission is to train Logistic Regression and Decision Tree models using combined data of NASA and the ISRO. dataset: "nasa_rocket_launch_data.csv" and "isro_rocket_launch_data.csv".

πŸ” Task Details πŸ”

Improve Accuracy: Train the Logistic Regression and Decision Tree models on combined NASA and the ISRO dataset.

Model Evaluation: Evaluate the models on the test set of the combined dataset and note down their accuracies.

πŸ›  Coding Task πŸ› 

Use the provided code template to complete this task.

# Code
​
​
​
​
Store X_test, the model and their predictions in the respective manner and, assign to q4.
"q4 = [X_test, model_1 , model_1_pred, model_2 , model_2_pred]"
​
q4 = ###
πŸ§ͺ Testing Your Solution πŸ§ͺ

After completing the coding task, run the tests provided below to verify the correctness of your solution. If your solution is incorrect, the tests will provide feedback on how to refine your code.

################ Don't edit or delete the cell, Run this cell to test your code ################
try:
from test_space import space_mod
space_mod.save_ans4(q4)
except:
print("Please check if the variable to the question has been assigned properly")
Task 6: Random Forest Hyperparameter Tuning
πŸš€ Mission Briefing πŸš€

The Decision Tree model provides a good foundation, but we can potentially improve our predictions using a Random Forest, which aggregates the results of multiple decision trees. However, Random Forests come with their own set of hyperparameters that need tuning for optimal performance.

Your mission is to perform hyperparameter tuning on a Random Forest model using the combined NASA and ISRO dataset. Specifically, you will tune three hyperparameters: n_estimators, max_depth, and min_samples_split.

πŸ” Task Details πŸ”

Hyperparameter Tuning: Use GridSearchCV to find the best hyperparameters for the Random Forest model from the given ranges:

n_estimators: [50, 100, 150]
max_depth: [None, 10, 20, 30]
min_samples_split: [2, 5, 10]
Model Evaluation: Train a Random Forest model with the best hyperparameters on the combined dataset and evaluate its accuracy on the test set.

# Code
​
​
​
Save the best_params as a dict to q5 variable
"q5 = {'max_depth': _, 'min_samples_split': _, 'n_estimators': _}"
q5 = ###
################ Don't edit or delete the cell, Run this cell to test your code ################
try:
from test_space import space_mod
space_mod.save_ans5(q5)
except:
print("Please check if the variable to the question has been assigned properly")
Task 7: Real-time Predictions with Random Forest
πŸš€ Mission Briefing πŸš€

Now that we have a tuned Random Forest model, it's time to put it to the test with some real-time data. This will help us understand how well our model performs in a real-world scenario.

πŸ” Task Details πŸ”

Data: Real-time data for ISRO missions give below in 2 rows.
data = {
'Mission_Name': ['Chandrayaan 4', 'Aditya L2'],
'Crewed_or_Uncrewed': ['Uncrewed', 'Uncrewed'],
'High_Temp': [120, 6000],
'Low_Temp': [-150, 4000],
'Ave_Temp': [-30, 5000],
'Temp_at_Launch_Time': [25, 5500],
'Hist_High_Temp': [130, 6500],
'Hist_Low_Temp': [-160, 3500],
'Hist_Ave_Temp': [-40, 5000],
'Percipitation_at_Launch_Time': [0, 0],
'Hist_Ave_Percipitation': [0, 0],
'Wind_Direction': ['SE', 'E'],
'Max_Wind_Speed': [0, 0],
'Visibility': ['8', '1'],
'Wind_Speed_at_Launch_Time': [0, 0],
'Condition': ['Clear', 'Solar']
}
Mission_Name Crewed or Uncrewed High Temp Low Temp Ave Temp Temp at Launch Time Hist High Temp Hist Low Temp Hist Ave Temp Percipitation at Launch Time Hist Ave Percipitation Wind Direction Max Wind Speed Visibility Wind Speed at Launch Time Condition
Chandrayaan 4 Uncrewed 120 -150 -30 25 130 -160 -40 0 0 SE 0 8 0 Clear
Aditya L2 Uncrewed 6000 4000 5000 5500 6500 3500 5000 0 0 S 0 1 0 Solar
Predictions: Use the trained Random Forest model with best parameters to make predictions on the real-time data.
# Code
​
​
​
Store X_test, the model and their predictions in the respective manner and, assign to q6.
"q6 = [X_test, model_1 , model_1_pred] "
q6 = ###
################ Don't edit or delete the cell, Run this cell to test your code ################
try:
from test_space import space_mod
space_mod.save_ans6(q6)
except:
print("Please check if the variable to the question has been assigned properly")
Please run the below cell to save your answers and perform testing
from test_space import space_mod
try:
space_mod.save_answer(q1,q2,q3,q4,q5,q6)
except:
print("Assign the answers to all the variables properly")
space_mod.remove_pickle()
try:
space_mod.save_ans1(q1)
except:
pass
try:
space_mod.save_ans2(q2)
except:
pass
try:
space_mod.save_ans3(q3)
except:
pass
try:
space_mod.save_ans4(q4)
except:
pass
try:
space_mod.save_ans5(q5)
except:
pass
try:
space_mod.save_ans6(q6)
except:
pass
πŸš€ Good luck, Mission Director!
Your expertise will ensure the success of the ISRO launch!!!

🌌 Let creativity guide our journey to the stars.
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.