Git Product home page Git Product logo

scalar_ml_reflection's Introduction

Group equivariant networks for a scalar field theory

This repository contains a Group equivariant convolutional neural network (G-CNN) that includes translations and reflections of a 2 dimensional lattice.

Setup

Download the dataset from this repository at Zenodo. Adjust the path_data variable in Training and Testing.ipynb and Optuna.ipynb accordingly. The path is initialized to the ./datasets folder in this repository.

The conda environment that we used for this task is provided in the env.yml file. It is the same one as for the counting task. Thus, if it already exists, it only needs to be activated via shell with:

conda activate scalar_ml_reflection

If not, it needs to be created first:

conda env create -f env.yml
conda activate scalar_ml_reflection

Source files

In ./src the two files refconv2d.py and transform_featuremaps.py are stored.

  • refconv2d.py: Here the equivariant convolutional layer is defined. It is equivariant under translations and reflections of the underlying lattice.
  • transform_featuremaps.py: This stores the functions transforming the feature maps under the reflections in t, x, and t+x direction. It transforms featuremaps that represent different fluxvariables each according to the underlying transformation behavior. Translations are not included her but can be accomplished by the function torch.roll if needed.

Nothing should be changed here.

Training and testing models

In the jupyter notebook Training and Testing.ipynb various models can be trained and tested. Additional classes and functions are stored in the corresponding python file training_and_testing.py.

If the notebook is executed, it will create two .pickle files: one containing the test results on the $60 \times 4$ lattice and one containing the test results on other lattice sizes.

  • path_data should be pointing to the directory containing the datasets from this repository.
  • name_string_helper defines the name of the .pickle file where the testing data will be stored.

The test results are displayed in the jupyter notebook Test Plots.ipynb. In order to do that, the .pickle files that shall be plotted have to be added to the lists filenames and ls_filenames.

Looking for good architectures with Optuna

We use optuna to look for well-performing architectures. The jupyter notebook Optuna.ipynb contains such a search. It produces one .pickle file for each number of training samples that is chosen. Additional classes and functions are stored in Optuna.py.

Code overview

  • Optuna.ipynb launches an optuna search
  • Optuna.py contains classes and functions for Optuna.ipynb
  • Test Plots.ipynb displays the test results of models trained in Training and Testing.ipynb
  • Training and Testing.ipynb trains and tests models of an architecture that has to be specified
  • training_and_testing.py contains classes and functions for Training and Testing.ipynb

scalar_ml_reflection's People

Contributors

lukasein avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.