4. Regression and Classification Models
Activity 4.01: Creating a Multi-Layer ANN with TensorFlow
Solution:
- Open a new Jupyter notebook to implement this activity.
- Import the TensorFlow and pandas libraries:
import tensorflow as tf import pandas as pd
- Load in the dataset using the pandas
read_csv
function:df = pd.read_csv('superconductivity.csv')
Note
Make sure you change the path (highlighted) to the CSV file based on its location on your system. If you're running the Jupyter notebook from the same directory where the CSV file is stored, you can run the preceding code without any modification.
- Drop the
date
column and drop any rows that have null values:df.dropna(inplace=True)
- Create target and feature datasets:
target = df['critical_temp'] features = df.drop('critical_temp', axis=1)
- Rescale the feature dataset:
from sklearn.preprocessing import StandardScaler scaler = StandardScaler() feature_array = scaler.fit_transform...