This code creates the main folders for a machine learning project. It helps you start with a clean and organized setup.
ML Python
import os
# Create folders for ML project structure
folders = [
'data/raw',
'data/processed',
'notebooks',
'src',
'tests',
'models',
'outputs/figures',
'outputs/logs'
]
for folder in folders:
os.makedirs(folder, exist_ok=True)
print('Folders created:')
for folder in folders:
print(f'- {folder}')
OutputSuccess
Important Notes
Keep your code and data separate to avoid confusion.
Use README.md to explain your project and how to run it.
Track dependencies in requirements.txt for easy setup.
Summary
Organize your ML project with clear folders for data, code, models, and outputs.
Separate raw and processed data to keep original files safe.
Use notebooks for exploration and scripts for training and processing.
Practice
(1/5)
1. Which folder in an ML project should you use to store the original, untouched data files?
easy
A. Raw data folder
B. Processed data folder
C. Models folder
D. Scripts folder
Solution
Step 1: Understand the purpose of raw data folder
The raw data folder is meant to keep the original data safe and unchanged.
Step 2: Differentiate from processed data folder
The processed data folder contains cleaned or transformed data, not the original files.
Final Answer:
Raw data folder -> Option A
Quick Check:
Original data = Raw data folder [OK]
Hint: Original files go to raw data folder to keep them safe [OK]
Common Mistakes:
Putting original data in processed folder
Mixing models with data files
Saving scripts in data folders
2. Which of the following is the correct way to organize code in an ML project?
easy
A. Put all code, notebooks, and models in one folder
B. Keep processed data and scripts mixed in one folder
C. Separate notebooks for exploration and scripts for training
D. Save models inside the raw data folder
Solution
Step 1: Identify the role of notebooks and scripts
Notebooks are for exploring data and ideas; scripts are for running training and processing tasks.
Step 2: Understand folder separation
Keeping notebooks and scripts separate helps keep the project organized and clear.
Final Answer:
Separate notebooks for exploration and scripts for training -> Option C
Quick Check:
Notebooks ≠ scripts folder [OK]
Hint: Use notebooks for exploring, scripts for running training [OK]
Where should you save a trained model file after training?
medium
A. data/raw/
B. scripts/
C. notebooks/
D. models/
Solution
Step 1: Understand folder purposes
The models folder is designed to store trained model files for reuse and deployment.
Step 2: Exclude other folders
Data folders are for data files, notebooks for exploration, scripts for code execution, so models belong in models/.
Final Answer:
models/ -> Option D
Quick Check:
Trained model files go to models folder [OK]
Hint: Save trained models in the models folder [OK]
Common Mistakes:
Saving models in data folders
Putting models inside notebooks folder
Confusing scripts folder with models
4. You find that your ML project has raw data and processed data mixed in the same folder. What is the best fix?
medium
A. Rename all files to indicate if they are raw or processed
B. Move raw data to a separate 'raw' folder and processed data to 'processed' folder
C. Delete the processed data and keep only raw data
D. Keep all data in one folder but add a README explaining the files
Solution
Step 1: Identify the problem
Mixing raw and processed data risks overwriting or confusion about data versions.
Step 2: Organize data properly
Separating raw and processed data into different folders keeps original data safe and processed data clear.
Final Answer:
Move raw data to a separate 'raw' folder and processed data to 'processed' folder -> Option B
Quick Check:
Separate raw and processed data folders [OK]
Hint: Keep raw and processed data in separate folders [OK]
Common Mistakes:
Deleting processed data unnecessarily
Only renaming files without moving
Relying on README without folder separation
5. You want to share your ML project with a teammate. Which folder should you exclude to keep the project size small and avoid sharing large temporary files?
hard
A. outputs/
B. data/raw/
C. models/
D. notebooks/
Solution
Step 1: Identify large temporary files
The outputs folder usually contains temporary results like logs, plots, or intermediate files that can be large and rebuilt.
Step 2: Decide what to share
Models, raw data, and notebooks are important for reproducing work, so outputs can be excluded to save space.
Final Answer:
outputs/ -> Option A
Quick Check:
Exclude outputs folder to reduce project size [OK]
Hint: Exclude outputs folder to avoid sharing large temp files [OK]
Common Mistakes:
Excluding raw data which is needed
Removing models folder by mistake
Not excluding any folder and sharing everything
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.