-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathfeaturize_assignment.py
More file actions
69 lines (51 loc) · 2.89 KB
/
featurize_assignment.py
File metadata and controls
69 lines (51 loc) · 2.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# ======================================================================================
# ASSIGNMENT 4: Using Featurization to Optimize for Hardness
# Your goal is to use Honegumi and your knowledge of the Ax API to develop an
# optimization script to help find a composition that maximizes the yield strength
# of a developed alloy. Your experimental budget is limited to 25 experiments. A
# synthetic objective function has been provided that will serve as a proxy for real
# experimental measurements.
# ======================================================================================
from utils import set_seeds, featurize_data, measure_hardness
set_seeds() # setting the random seed for reproducibility
# --------------------------------------------------------------------------------------
# TASK A: Featurize the data using the featurize_data function.
# --------------------------------------------------------------------------------------
import pandas as pd
train = pd.read_csv("data/train.csv")
candidate = pd.read_csv("data/candidate.csv")
# TODO: Your Code Goes Here
# --------------------------------------------------------------------------------------
# TASK B: Use Honegumi to set up the optimization problem and attach the training data.
# --------------------------------------------------------------------------------------
import numpy as np
from ax.service.ax_client import AxClient, ObjectiveProperties
from ax.modelbridge.factory import Models
from ax.modelbridge.generation_strategy import GenerationStep, GenerationStrategy
gs = GenerationStrategy(
steps=[
GenerationStep(
model= # TODO: Your Code Goes Here,
num_trials=-1,
max_parallelism=3,
),
]
)
# TODO: Your Code Goes Here
# --------------------------------------------------------------------------------------
# TASK C: Build the optimization loop and and evaluate 25 candidates.
# --------------------------------------------------------------------------------------
from ax.core.observation import ObservationFeatures
# TODO: Your Code Goes Here
# --------------------------------------------------------------------------------------
# TASK D: Report the optimal composition and associated hardness.
# --------------------------------------------------------------------------------------
# TODO: Your Code Goes Here
# --------------------------------------------------------------------------------------
# TASK E: Report the most important feature and its correlation for predicting hardness.
# --------------------------------------------------------------------------------------
# TODO: Your Code Goes Here
# --------------------------------------------------------------------------------------
# TASK F: How many materials have a hardness greater than 43?
# --------------------------------------------------------------------------------------
# TODO: Your Code Goes Here