ME XXXXXXXXXXHomework 1 Band Gap of 2D Mechanical Metamaterials In this homework, you will apply the machine learning techniques taught in class to predict the band gaps of 2D mechanical...

1 answer below »
I have attached a file that shows what my homework is. I use MatLab and python to detect band gaps in a system and use these as classifiers for machine learning.


ME 555-03 Homework 1 Band Gap of 2D Mechanical Metamaterials In this homework, you will apply the machine learning techniques taught in class to predict the band gaps of 2D mechanical metamaterials. The dataset can be found here. The metamaterial designs we consider here are made by tessellating 10 × 10 unit-cells. Each unit cell consists of two constituent mate- rials, one is soft and the other is stiff. Here, we only consider symmetric unit cells, or more specifically unit cells with four lines of symmetry. As shown in Figure 1, due to the symmetry, the design is uniquely defined by only 15 pix- els, which could be represented by a 15 dimensional binary vector (0 means soft and 1 means stiff). Therefore, we have 215 = 32768 designs in total, and their raw features, represented as 15 dimensional binary vectors, are stored in band gap_data[‘feature_raw’], as a 32768 × 15 numpy array. Figure 1: Using a 15 dimensional binary vector to construct the symmetric unit cell, and tiling the unit cell to create the whole material We also introduce here the shape-frequency features as an interpretable rep- resentation of the metamaterial designs. To calculate the shape-frequency fea- tures, we chose 20 different shapes of sliding windows. For each shape, we slide it over the material and calculate the probability that all pixels in the window are soft constituent material. The shape-frequency features of all 32768 designs 1 https://drive.google.com/drive/folders/19WwbIQ0R4x9EU5QNmgxj1l5--vmA2O9_?usp=sharing are already calculated and stored in band gap_data[‘feature_shapefreq’] as a 32768 × 20 numpy array. The target of our prediction model is the band gap of these metamaterials. The mechanical band gap is defined as a frequency gap between the dispersion curves, which is a set of curves that represent the propagation of wave modes that are found in a specific geometry. In Figure 2, we show an example of dispersion curves and the corresponding band gaps. The dispersion curves of all designs are simulated using FEM. For each design, the simulation produces 20 dispersion curves and each curve consists of 150 points. The dispersion curves are stored in band gap_data[‘dispersion’] as a 32768×20×150 numpy array. Figure 2: Example of band gaps. (a) First, let’s create the labels for our machine learning model. Each observation is a unit cell. We want to predict whether, given a new unit cell, there exists a band gap within a given frequency range (flow, fhigh]. Please implement a function that takes the dispersion curves and frequency range (flow, fhigh] as input, and outputs whether there exists a band gap in the frequency range (0 for not exist, and 1 for exist). Note that the band gap does not need be entirely covered by the frequency range. The existence counts as long as long the band gap intersects with the frequency range. That is, as long as the intersection of (flow, fhigh] with the band gap range is nonempty, the label is 1 (positive samples), otherwise 0 (negative samples). Please calculate the labels for frequency range (1000, 1500]. What’s the percentage of positive samples? (b) Before building our prediction model, we may want to explore the data and get some basic information about it. Dimension reduction methods can reduce high 2 dimensional data to 2 dimensions while preserving high-dimensional structure, allowing us to visualize the data in a 2D plot. Please perform dimension re- duction for both raw features and shape-frequency features using PaCMAP. See this link for more details of the PaCMAP package. Please set n_neighbors=15 for PaCMAP. During the visualization, please color the points according to the label of whether there is a band gap in frequency range (1000, 1500]. Do the 2D plots of the raw features and shape-frequency features look the same? Or are they qualitatively different? Specifically, please try to explain why the 2D plot of the raw features look like this. Hints: Install PaCMAP package by pip install pacmap You should set save_pairs=False when calling fit_transform. You may use matplotlib.pyplot.scatter to visualize the 2D data after dimension reduc- tion, see this link for more details. (c) Train gradient boosted decision trees (GBDT) to predict band gaps in frequency range (1000, 1500]. You should train one model on the 15 raw features and an- other model on the 20 shape-frequency features, and compare their test accu- racy. To achieve good performance, please set the tree depths to be at least 10. Please split the dataset into training set (80%) and test set (20%), and use the training set to train the model and use the test set to evaluate the performance. Hints: You may want to use one of the existing packages for gradient boosted decision trees. You can use sklearn.ensemble.GradientBoostingClassifier of the sklearn package, see this link for more details. Also, LightGBM is one of the best package of GBDT, achieving both high accuracy and fast speed, see this example of detailed usage. Install these two packages by pip install scikit-learn pip install lightgbm (d) Using the model trained in (c), calculate the variable importance (model re- liance) for each of the shape-frequency features. Use (1 - accuracy) as the loss in the variable importance calculation. Which shape-frequency feature is the most important one? (e) Train a generalized additive model (GAM) to predict band gaps in frequency range (1000, 1500] using the 20 shape-frequency features (not the raw features). Please calculate the test accuracy, and the variable importance for each feature. What does the component function of the most important feature look like? Hints: You can use Explainable Boosting Machine (EBM) in the InterpretML package for this question, which is a GAM based on GBDT. Since this is a 3 https://github.com/YingfanWang/PaCMAP https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.scatter.html https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.GradientBoostingClassifier.html https://github.com/microsoft/LightGBM/blob/master/examples/python-guide/simple_example.py https://github.com/interpretml/interpret https://github.com/interpretml/interpret classification problem, you should use ExplainableBoostingClassifier as the model. Also, you should set interactions=0 to disable the interaction terms and use the default setting for the other hyperparameters. You can use interpret.show(model.explain_global()) to visualize the component func- tions on jupyter notebook. Install the InterpretML package by pip install interpret (f) Compare the predictive performance of the two models (GBDT and GAM trained on the shape-frequency features), and explain why one model performs better than the other on this task. 4
Answered 1 days AfterJan 22, 2022

Answer To: ME XXXXXXXXXXHomework 1 Band Gap of 2D Mechanical Metamaterials In this homework, you will apply the...

Mohd answered on Jan 24 2022
116 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here