Skip to content

Commit

Permalink
rename GeneartorMaster to GeneratorBase
Browse files Browse the repository at this point in the history
  • Loading branch information
henrysky committed Sep 7, 2024
1 parent 9c0ebc4 commit 9cccdf1
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 22 deletions.
3 changes: 1 addition & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
torch
tensorflow-cpu
sphinx>=8
sphinx_rtd_theme>=3.0.0a0
sphinx-prompt
sphinx-copybutton

sphinx>=8
nbsphinx
ipykernel
File renamed without changes
4 changes: 2 additions & 2 deletions docs/source/neuralnets/basic_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ Available astroNN Neural Net Classes
--------------------------------------

All astroNN Neural Nets are inherited from some child classes which inherited NeuralNetBase, NeuralNetBase also
relies relies on two major component, `Normalizer` and `GeneratorMaster`
relies relies on two major component, `Normalizer` and `GeneratorBase`

::

Normalizer (astroNN.nn.utilities.normalizer.Normalizer)

GeneratorMaster (astroNN.nn.utilities.generator.GeneratorMaster)
GeneratorBase (astroNN.nn.utilities.generator.GeneratorBase)
├── CNNDataGenerator
├── Bayesian_DataGenerator
└── CVAE_DataGenerator
Expand Down
4 changes: 2 additions & 2 deletions docs/source/quick_start.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ or if you want to install it in editable mode, you can run:
Prerequisites
---------------

``astroNN`` requires Python 3.9 or above. The following packages are required which will be installed automatically when you install ``astroNN``:
``astroNN`` requires Python 3.10 or above. The following packages are required which will be installed automatically when you install ``astroNN``:

.. literalinclude:: ../../requirements.txt

Expand Down Expand Up @@ -225,7 +225,7 @@ How to set environment variable on different operating system: `Guide here`_
A dedicated project folder is recommended to run astroNN, always run astroNN under the root of project folder. So that
astroNN will always create folder for every neural network you run under the same place. Just as below

.. image:: astronn_master_folder.PNG
.. image:: astronn_folder.png
:scale: 50 %

.. _Guide here: https://www.schrodinger.com/kb/1842
Expand Down
8 changes: 4 additions & 4 deletions src/astroNN/models/base_bayesian_cnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from astroNN.nn.metrics import categorical_accuracy, binary_accuracy
from astroNN.nn.numpy import sigmoid
from astroNN.nn.utilities import Normalizer
from astroNN.nn.utilities.generator import GeneratorMaster
from astroNN.nn.utilities.generator import GeneratorBase
from astroNN.shared.dict_tools import dict_np_to_dict_list, list_to_dict

from astroNN.nn.losses import (
Expand All @@ -40,7 +40,7 @@
Adam = keras.optimizers.Adam


class BayesianCNNDataGenerator(GeneratorMaster):
class BayesianCNNDataGenerator(GeneratorBase):
"""
To generate data to NN
Expand Down Expand Up @@ -108,7 +108,7 @@ def on_epoch_end(self):
)


class BayesianCNNPredDataGenerator(GeneratorMaster):
class BayesianCNNPredDataGenerator(GeneratorBase):
"""
To generate data to NN for prediction
Expand Down Expand Up @@ -934,7 +934,7 @@ def predict(self, input_data, inputs_err=None, batch_size=None):
}

def predict_dataset(self, file):
class BayesianCNNPredDataGeneratorV2(GeneratorMaster):
class BayesianCNNPredDataGeneratorV2(GeneratorBase):
def __init__(
self,
batch_size,
Expand Down
6 changes: 3 additions & 3 deletions src/astroNN/models/base_cnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from astroNN.nn.losses import mean_squared_error, mean_absolute_error, mean_error
from astroNN.nn.metrics import categorical_accuracy, binary_accuracy
from astroNN.nn.utilities import Normalizer
from astroNN.nn.utilities.generator import GeneratorMaster
from astroNN.nn.utilities.generator import GeneratorBase
from astroNN.shared.dict_tools import dict_np_to_dict_list, list_to_dict
from sklearn.model_selection import train_test_split

Expand All @@ -26,7 +26,7 @@
Adam = keras.optimizers.Adam


class CNNDataGenerator(GeneratorMaster):
class CNNDataGenerator(GeneratorBase):
"""
To generate data to NN
Expand Down Expand Up @@ -92,7 +92,7 @@ def on_epoch_end(self):
)


class CNNPredDataGenerator(GeneratorMaster):
class CNNPredDataGenerator(GeneratorBase):
"""
To generate data to NN for prediction
Expand Down
6 changes: 3 additions & 3 deletions src/astroNN/models/base_vae.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
mean_squared_reconstruction_error,
)
from astroNN.nn.utilities import Normalizer
from astroNN.nn.utilities.generator import GeneratorMaster
from astroNN.nn.utilities.generator import GeneratorBase
from astroNN.shared.dict_tools import dict_np_to_dict_list, list_to_dict
from sklearn.model_selection import train_test_split

Expand All @@ -24,7 +24,7 @@
Adam = keras.optimizers.Adam


class CVAEDataGenerator(GeneratorMaster):
class CVAEDataGenerator(GeneratorBase):
"""
To generate data to NN
Expand Down Expand Up @@ -88,7 +88,7 @@ def on_epoch_end(self):
)


class CVAEPredDataGenerator(GeneratorMaster):
class CVAEPredDataGenerator(GeneratorBase):
"""
To generate data to NN for prediction
Expand Down
7 changes: 1 addition & 6 deletions src/astroNN/nn/utilities/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@

import keras

try:
from keras.trainers.data_adapters.py_dataset_adapter import PyDataset
except ImportError:
from keras.src.trainers.data_adapters.py_dataset_adapter import PyDataset


class GeneratorMaster(PyDataset):
class GeneratorBase(keras.utils.PyDataset):
"""
| Top-level class of astroNN data pipeline to generate data for NNs.
Expand Down

0 comments on commit 9cccdf1

Please sign in to comment.