-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kessler
authored and
Kessler
committed
May 30, 2019
1 parent
5a67ff5
commit f5f544a
Showing
15 changed files
with
70 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
from ecnet.server import Server | ||
__version__ = '3.0.1' | ||
__version__ = '3.1.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
# -*- coding: utf-8 -*- | ||
# | ||
# ecnet/models/mlp.py | ||
# v.3.0.1 | ||
# v.3.1.0 | ||
# Developed in 2019 by Travis Kessler <[email protected]> | ||
# | ||
# Contains the "MultilayerPerceptron" (feed-forward neural network) class | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,14 +2,14 @@ | |
# -*- coding: utf-8 -*- | ||
# | ||
# ecnet/server.py | ||
# v.3.0.1 | ||
# v.3.1.0 | ||
# Developed in 2019 by Travis Kessler <[email protected]> | ||
# | ||
# Contains the "Server" class, which handles ECNet project creation, neural | ||
# network model creation, data hand-off to models, prediction error | ||
# calculation, input parameter selection, hyperparameter tuning. | ||
# | ||
# For example scripts, refer to https://github.com/ecrl/ecnet/examples | ||
# For example scripts, refer to https://ecnet.readthedocs.io/en/latest/ | ||
# | ||
|
||
# ECNet imports | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
# -*- coding: utf-8 -*- | ||
# | ||
# ecnet/tasks/limit_inputs.py | ||
# v.3.0.1 | ||
# v.3.1.0 | ||
# Developed in 2019 by Travis Kessler <[email protected]> | ||
# | ||
# Contains functions for selecting influential input parameters | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
# -*- coding: utf-8 -*- | ||
# | ||
# ecnet/tasks/remove_outliers.py | ||
# v.3.0.1 | ||
# v.3.1.0 | ||
# Developed in 2019 by Travis Kessler <[email protected]> | ||
# | ||
# Contains function for removing outliers from ECNet DataFrame | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
# -*- coding: utf-8 -*- | ||
# | ||
# ecnet/tasks/tuning.py | ||
# v.3.0.1 | ||
# v.3.1.0 | ||
# Developed in 2019 by Travis Kessler <[email protected]> | ||
# | ||
# Contains functions/fitness functions for tuning hyperparameters | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
# -*- coding: utf-8 -*- | ||
# | ||
# ecnet/tools/conversions.py | ||
# v.3.0.1 | ||
# v.3.1.0 | ||
# Developed in 2019 by Travis Kessler <[email protected]> | ||
# | ||
# Contains functions for converting various chemical file formats | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
# -*- coding: utf-8 -*- | ||
# | ||
# ecnet/tools/database.py | ||
# v.3.0.1 | ||
# v.3.1.0 | ||
# Developed in 2019 by Travis Kessler <[email protected]> | ||
# | ||
# Contains functions for creating ECNet-formatted databases | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,34 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
# | ||
# ecnet/tools/plotting.py | ||
# v.3.1.0 | ||
# Developed in 2019 by Travis Kessler <[email protected]> | ||
# | ||
# Contains functions/classes for creating various plots | ||
# | ||
|
||
# stdlib. imports | ||
from math import sqrt | ||
|
||
# 3rd party imports | ||
from matplotlib import pyplot as plt | ||
from matplotlib.offsetbox import AnchoredText | ||
from math import sqrt | ||
|
||
|
||
class ParityPlot: | ||
|
||
def __init__(self, title='Parity Plot', x_label='Experimental Value', | ||
y_label='Predicted Value', font='Times New Roman'): | ||
''' ParityPlot: creates a plot of predicted values vs. experimental | ||
data relative to a 1:1 parity line | ||
Args: | ||
title (str): title of the plot | ||
x_label (str): x-axis label for the plot | ||
y_label (str): y-axis label for the plot | ||
font (str): font for the plot | ||
''' | ||
|
||
plt.rcParams['font.family'] = font | ||
plt.title(title) | ||
|
@@ -16,6 +38,14 @@ def __init__(self, title='Parity Plot', x_label='Experimental Value', | |
self._labels = None | ||
|
||
def add_series(self, x_vals, y_vals, name=None, color=None): | ||
''' Adds data to the plot | ||
Args: | ||
x_vals (iter): x values for the series | ||
y_vals (iter): y values for the series (same length as x_vals) | ||
name (str): if not None, names the series and places legend | ||
color (str): if not None, uses specified color to denote series | ||
''' | ||
|
||
if len(x_vals) != len(y_vals): | ||
raise ValueError('Length of supplied X and Y values are not equal:' | ||
|
@@ -30,23 +60,41 @@ def add_series(self, x_vals, y_vals, name=None, color=None): | |
self._max_val = y_max | ||
|
||
def add_error_bars(self, error, label=None): | ||
''' Adds error bars, +/- the error relative to the 1:1 parity line | ||
Args: | ||
error (int, float): error value | ||
label (str): if not None, adds the name/value to the legend | ||
''' | ||
|
||
self._add_parity_line(offset=error) | ||
self._add_parity_line(offset=(-1 * error)) | ||
if label is not None: | ||
self._add_label(label, error) | ||
|
||
def show(self): | ||
''' Shows the plot on-screen ''' | ||
|
||
self._add_parity_line() | ||
plt.show() | ||
|
||
def save(self, filename): | ||
''' Saves the plot to a file | ||
Args: | ||
filename (str): path to desired save location/file | ||
''' | ||
|
||
self._add_parity_line() | ||
plt.savefig(filename) | ||
|
||
def _add_parity_line(self, offset=0): | ||
''' Adds a 1:1 parity line | ||
Args: | ||
offset (int, float): if not 0, adds a +/- offset relative to y=0 | ||
when x=0 parity line | ||
''' | ||
|
||
if offset < 0: | ||
direction = -1 | ||
|
@@ -63,6 +111,12 @@ def _add_parity_line(self, offset=0): | |
) | ||
|
||
def _add_label(self, label, value): | ||
''' Adds a label and value to the plot's legend | ||
Args: | ||
label (str): name of the label | ||
value (int, float): value of the label | ||
''' | ||
|
||
string = '{}: '.format(label) + '%.3f' % value | ||
if self._labels is None: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
# -*- coding: utf-8 -*- | ||
# | ||
# ecnet/tools/project.py | ||
# v.3.0.1 | ||
# v.3.1.0 | ||
# Developed in 2019 by Travis Kessler <[email protected]> | ||
# | ||
# Contains functions for predicting data using pre-existing .prj files | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
# -*- coding: utf-8 -*- | ||
# | ||
# ecnet/utils/data_utils.py | ||
# v.3.0.1 | ||
# v.3.1.0 | ||
# Developed in 2019 by Travis Kessler <[email protected]> | ||
# | ||
# Contains functions/classes for loading data, saving data, saving results | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
# -*- coding: utf-8 -*- | ||
# | ||
# ecnet/utils/error_utils.py | ||
# v.3.0.1 | ||
# v.3.1.0 | ||
# Developed in 2019 by Travis Kessler <[email protected]> | ||
# | ||
# Contains functions for error calculations | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
# -*- coding: utf-8 -*- | ||
# | ||
# ecnet/utils/logging.py | ||
# v.3.0.1 | ||
# v.3.1.0 | ||
# Developed in 2019 by Travis Kessler <[email protected]> | ||
# | ||
# Contains logger used by ECNet | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
# -*- coding: utf-8 -*- | ||
# | ||
# ecnet/utils/server_utils.py | ||
# v.3.0.1 | ||
# v.3.1.0 | ||
# Developed in 2019 by Travis Kessler <[email protected]> | ||
# | ||
# Contains functions used by ecnet.Server | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters