Comments (6)
@txie-93 I think this is a related question on our part, but we are looking to extract an intermediate layer from CGCNN. Any suggestions on how to go about this?
from cgcnn.
@vmeschke and @sgbaird Sorry for my slow reply. In case you haven't solved the problem, I feel the easiest way is to return the feature vector of the intermediate layer similar to the out
. For example, you may return both out
and crys_fea
.
Lines 152 to 166 in d612a69
from cgcnn.
Hi @txie-93,
Thank you for your response! By including crys_fea as a second output of model.py: CrystalGraphConvNet.forward(), I also need to update main.py train() and validate()
Line 251 in d612a69
Line 350 in d612a69
to be
output, crys_fea = model(*input_var)
to avoid errors.
However, I'm a bit stuck at this point.
Each of these lines is nested inside two for
loops:
Lines 173 to 178 in d612a69
train():
Line 226 in d612a69
validate():
Line 325 in d612a69
Using Spyder and debugging, crys_fea
has the following properties for the sample-regression data: Type: Tensor
, Size: torch.Size([1, 128])
. Does the bottom level for
statement loop through each training (or validation) crystal structure?
Sterling
P.S. I've been looking into how to extract the intermediate layers using PyTorch hooks, but haven't been able to figure it out, hence the above approach. I'm relatively new to python (bulk of my experience is in MATLAB and Mathematica).
from cgcnn.
Each of these lines is nested inside two for loops:
One iteration in the outer loop trains the model with the entire dataset. One iteration in the inner loop trains the model with one batch.
Using Spyder and debugging, crys_fea has the following properties for the sample-regression data: Type: Tensor, Size: torch.Size([1, 128]).
I think this is because you are having a batch size of 1?
I am not exactly sure what you want. Sometime people want to visualize the learned feature vectors for each crystal. These feature vectors are usually only meaningful after the training. You may want to get all the feature vectors in the testing data?
from cgcnn.
We're interested in extracting feature vectors for all the input crystals and trying to feed these into a different model. We were thinking that the first iteration might have the most "correspondence" to the original crystal structures, but we were also considering using the last iteration (i.e. I think before applying softmax?).
Since we're not exactly sure whether we want the first, last, or an intermediate iteration's feature vectors (we will probably come to know through testing), I think what I want is to be able to extract crys_fea
for each crystal (both training and test) at a given iteration. If you have a way of accessing the final iteration's feature vectors, we could start with that.
These feature vectors are usually only meaningful after the training.
Could you elaborate? (also, when you say after the training, do you mean after all iterations of the outer loop?)
from cgcnn.
Hi @txie-93 ,
I want to visualize the learned feature vectors for each crystal.
I want to get all the feature vectors in the testing data. I need these for my other training.
from cgcnn.
Related Issues (20)
- What does 'target' means in id_prop.csv?? HOT 2
- Description for Materials Project .csv files HOT 4
- Predict at atom level HOT 3
- why the cgcnn model cannot predict graphene and diamond? HOT 3
- The setting of hyperparameters to get the best performance HOT 2
- Data construction specifics HOT 2
- On understanding the AtomInitializer class
- The problem of using the Materials Project database and the Perovskite database HOT 3
- Add CIF module to be installed in the environment in README file HOT 2
- How to understand the shape of "nbr_fea_idx" in the code HOT 2
- Could you please tell me why do you use one hot encode?
- Question about fetching Materials Project Data HOT 2
- Problem with importing MPDataRetrieval HOT 1
- Size mismatch when loading pre-trained models HOT 6
- Atom features specifics
- Loading data issue with certain CIF files
- Multiclass classification HOT 1
- Bulid the element vector
- Questions about recreating a data set
- MAE for predicting and training shear modulus and bulk modulus is very large HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cgcnn.