• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tonegas / nnodely / 14319828903

07 Apr 2025 09:27PM UTC coverage: 97.259% (+0.2%) from 97.035%
14319828903

Pull #86

github

web-flow
Merge 44b7c25ee into e9c323c4f
Pull Request #86: Smallclasses

2275 of 2409 new or added lines in 54 files covered. (94.44%)

1 existing line in 1 file now uncovered.

11637 of 11965 relevant lines covered (97.26%)

0.97 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

64.81
/nnodely/visualizer/mplnotebookvisualizer.py
1
import matplotlib.pyplot as plt
1✔
2

3
from nnodely.visualizer.textvisualizer import TextVisualizer
1✔
4
from nnodely.layers.fuzzify import return_fuzzify
1✔
5
from nnodely.layers.parametricfunction import return_standard_inputs, return_function
1✔
6
from nnodely.support.utils import check
1✔
7
from mplplots import plots
1✔
8

9
class MPLNotebookVisualizer(TextVisualizer):
1✔
10
    def __init__(self, verbose = 1, *, test = False):
1✔
11
        super().__init__(verbose)
1✔
12
        if test:
1✔
13
            plt.ion()
1✔
14

15
    def showEndTraining(self, epoch, train_losses, val_losses):
1✔
16
        for key in self.modely.json['Minimizers'].keys():
1✔
17
            fig = plt.figure()
1✔
18
            ax = fig.add_subplot(111)
1✔
19
            plots.plot_training(ax, "Training", key, train_losses[key], val_losses[key])
1✔
20
        plt.show()
1✔
21

22
    def showResult(self, name_data):
1✔
23
        super().showResult(name_data)
1✔
24
        for key in self.modely.json['Minimizers'].keys():
1✔
25
            fig = plt.figure()
1✔
26
            ax = fig.add_subplot(111)
1✔
27
            plots.plot_results(ax, name_data, key, self.modely._prediction[name_data][key]['A'],
1✔
28
                               self.modely._prediction[name_data][key]['B'], self.modely._model_def['Info']["SampleTime"])
29
        plt.show()
1✔
30

31
    def showWeights(self, weights = None):
1✔
32
        pass
×
33

34
    def showFunctions(self, functions = None, xlim = None, num_points = 1000):
1✔
35
        check(self.modely.neuralized, ValueError, "The model has not been neuralized.")
1✔
36
        for fun, value in self.modely._model_def['Functions'].items():
1✔
37
            if fun in functions:
1✔
38
                if 'functions' in self.modely._model_def['Functions'][fun]:
1✔
39
                    x, activ_fun = return_fuzzify(value, xlim, num_points)
1✔
40
                    fig = plt.figure()
1✔
41
                    ax = fig.add_subplot(111)
1✔
42
                    plots.plot_fuzzy(ax, fun, x, activ_fun, value['centers'])
1✔
43
                    plt.show()
1✔
44
                elif 'code':
×
NEW
45
                    function_inputs = return_standard_inputs(value, self.modely._model_def, xlim, num_points)
×
46
                    function_output, function_input_list = return_function(value, function_inputs)
×
47
                    if value['n_input'] == 2:
×
48
                        x0 = function_inputs[0].reshape(num_points, num_points).tolist()
×
49
                        x1 = function_inputs[1].reshape(num_points, num_points).tolist()
×
50
                        output = function_output.reshape(num_points, num_points).tolist()
×
51
                        params = []
×
52
                        for i, key in enumerate(value['params_and_consts']):
×
53
                            params += [function_inputs[i + value['n_input']].tolist()]
×
54
                        plots.plot_3d_function(plt, fun, x0, x1, params, output, function_input_list)
×
55
                    else:
56
                        x = function_inputs[0].reshape(num_points).tolist()
×
57
                        output = function_output.reshape(num_points).tolist()
×
58
                        params = []
×
59
                        for i, key in enumerate(value['params_and_consts']):
×
60
                            params += [function_inputs[i + value['n_input']].tolist()]
×
61
                        plots.plot_2d_function(plt, fun, x, params, output, function_input_list)
×
62
                    plt.show()
×
63

64

65

66

67

68

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc