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

tonegas / nnodely / 13531440710

25 Feb 2025 09:36PM UTC coverage: 95.399% (-0.01%) from 95.411%
13531440710

Pull #65

github

web-flow
Merge 1bb29904b into 8d0789317
Pull Request #65: 49 general bug fix

46 of 53 new or added lines in 8 files covered. (86.79%)

1 existing line in 1 file now uncovered.

10574 of 11084 relevant lines covered (95.4%)

0.95 hits per line

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

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

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

9
class MPLNotebookVisualizer(TextVisualizer):
1✔
10
    def __init__(self, verbose = 1):
1✔
11
        super().__init__(verbose)
×
12

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

20
    def showResult(self, name_data):
1✔
21
        super().showResult(name_data)
×
22
        for key in self.n4m.model_def['Minimizers'].keys():
×
23
            fig = plt.figure()
×
24
            ax = fig.add_subplot(111)
×
25
            plots.plot_results(ax, name_data, key, self.n4m.prediction[name_data][key]['A'],
×
26
                               self.n4m.prediction[name_data][key]['B'], self.n4m.model_def['Info']["SampleTime"])
27
        plt.show()
×
28

29
    def showWeights(self, weights = None):
1✔
30
        pass
×
31

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

62

63

64

65

66

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