This file is indexed.

/usr/share/octave/packages/nnet-0.1.13/newp.m is in octave-nnet 0.1.13-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
## Copyright (C) 2007 Michel D. Schmid  <michaelschmid@users.sourceforge.net>
##
##
## This program is free software; you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2, or (at your option)
## any later version.
##
## This program  is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; see the file COPYING.  If not, write to the Free
## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
## 02110-1301, USA.

## -*- texinfo -*-
## @deftypefn {Function File} {@var{net}} = newp (@var{Pr},@var{ss},@var{transFunc},@var{learnFunc})
## @code{newp} create a perceptron
##
## @example
## PLEASE DON'T USE THIS FUNCTIONS, IT'S STILL NOT FINISHED!
## =========================================================
## @end example
## @example
## Pr - R x 2 matrix of min and max values for R input elements
## ss - a scalar value with the number of neurons
## transFunc - a string with the transfer function
##       default = "hardlim"
## learnFunc - a string with the learning function
##       default = "learnp"
## @end example
##
##
## @end deftypefn

## @seealso{}

## Author: Michel D. Schmid

function net = newp(Pr,ss,transFunc,learnFunc)

  ## initial descriptipn
  ##  newp(Pr,ss,transFunc,learnFunc)
  ##  * Pr is a nx2 matrix with min and max values of standardized inputs
  ##    Pr means: p-range
  ##  * ss is a scalar value which describes the number of neurons
  ##    of output neurons
  ##  * transFunc is the transfer function, standard is "hardlim"
  ##  * learnFunc is the learning function, standard is "learnp"

  ## check range of input arguments
  error(nargchk(1,4,nargin))

  ## set defaults
  if (nargin <2)
    ss = 1; # means one neuron
  endif
  if (nargin <3)
    transFunc = "hardlim";
  endif
  if (nargin <4)
    learnFunc = "learnp";
  endif

  ## check input args
  checkInputArgs(Pr,ss);

#   ## get number of layers (without input layer)
#   nLayers = length(ss);

  ## Standard architecture of neural network
  net = __newnetwork(1,1,1,"newp");
  ## description:
  ##	first argument: number of inputs, nothing else allowed till now
  ## it's not the same like the number of neurons in this input
  ## second argument: number of layers, including output layer
  ## third argument: number of outputs, nothing else allowed till now
  ## it's not the same like the number of neurons in this output
  ## fourth argument: network type


  ## set inputs with limit of only ONE input
  net.inputs{1}.range = Pr;
  [nRows, nColumns] = size(Pr);
  net.inputs{1}.size = nRows;

  ## set size of IW
  net.IW{1,1} = zeros(1,nRows);
  ## set number of bias, one per layer
  net.b{iBiases,1} = 0;

  ## define everything with "layers"
  net.numLayers = ss(end);
  net.layers = cell(1,1);
  net.layers{1}.size = ss(end);
  net.layers{1}.transFcn = transFunc;
  ## next row of code is only for MATLAB(TM) compatibility
  ## I never used this the last 4 years ...
  net.targets{i}.userdata = "Put your custom informations here!";

  ## performance function
  net.performFnc = "mae";

  ## learning
  net.biases{1}.learnFcn = learnFunc;
  net.inputWeights{1,1}.learnFcn = learnFunc;

  ## adaption
  net.adaptFcn = "trains";

  ## Training
  net.trainFcn = "trainc";

  ## Initialization
  net = __init(net);

# ======================================================
#
# additional check functions...
#
# ======================================================
  function checkInputArgs(Pr,ss)
    
    ## check if Pr has correct format
    if !isreal(Pr) | (size(Pr,2)!=2)
      error("Input ranges must be a two column matrix!")
    endif
    if any(Pr(:,1) > Pr(:,2)) # check if numbers in the second column are larger as in the first one
      error("Input ranges has values in the second column larger as in the same row of the first column.")
    endif

    ## check if ss has correct format, must be a scalar value
    if ( (size(ss,1)!=1) || (size(ss,2)!=1))
      error("Layer sizes is not a scalar value.")
    endif

  endfunction

# ========================================================  


endfunction