Complete the code to create a folder for storing raw data in an ML project.
import os os.makedirs('data/[1]', exist_ok=True)
The 'raw' folder is typically used to store the original unprocessed data in an ML project.
Complete the code to load a dataset CSV file from the data folder.
import pandas as pd df = pd.read_csv('data/[1]/dataset.csv')
The dataset CSV file is usually stored in the 'raw' data folder before processing.
Fix the error in the code to save a trained model to the models folder.
import joblib joblib.dump(model, 'models/[1].pkl')
The trained model should be saved with a descriptive name like 'trained_model' in the models folder.
Fill both blanks to create a dictionary comprehension that maps filenames to their sizes in the data/raw folder.
import os file_sizes = {f: os.path.getsize(os.path.join('data/raw', [1])) for [2] in os.listdir('data/raw')}
Use the variable name 'filename' consistently to refer to each file in the folder.
Fill all three blanks to create a function that loads data, trains a model, and saves it.
def train_and_save(data_path, model_path): import pandas as pd from sklearn.linear_model import LogisticRegression df = pd.read_csv(data_path) X = df.drop('[1]', axis=1) y = df['[2]'] model = LogisticRegression() model.fit(X, y) import joblib joblib.dump(model, model_path + '/[3].pkl')
The target column is often named 'label'. The saved model file is named 'trained_model'.