| |
- Method resolution order:
- DataInterface
- nupic.network.Parameterized.Parameterized
- __builtin__.object
Methods defined here:
- __init__(self)
- addDataFile(self, file)
- Add a data file which can be accessed starting at the prefix.
This is essentially just a way to add to the 'files' parameter.
- addDataFiles(self, files)
- Add a number of data files which will be accessed starting at prefix.
This is essentially just a way to add to the 'files' parameter.
- cleanup(self)
- Clean up data which has been created. This method is called when the
test being run no longer has any need for the DataInterface object's data.
Child classes should override this method especially for DataInterface
objects that create large data sets because otherwise you risk having
large quantities of data left over, clogging your disks.
- createData(self)
- Create data, any files of which should be placed at self['prefix'].
Child classes should override this method if they need to create any
data.
- getData(self)
- Return data which has been created, in a form conducive to plotting.
This method is useful when trying to plot the data along with something
else, such as accuracy. The format is:
[[[x,y,z],[x,y,z], ...], #row 1
[[x,y,z],[x,y,z], ...], #row 2
...]
Child classes should override this method to let other people plot this
data easily. It is recommended to use this method in your own
visualizeData method.
- getPrefixedDataFiles(self)
- Get the data file names, including the prefix. The list of files used
for this function contained in the parameter 'files'.
- visualizeData(self, filename=None)
- Visualize data which has been created. Therefore, createData should be
run first. Child classes should override this method in order to give a
hook to visualize data. We used to provide functions called 'easyPlot2D'
and 'easyPlot3D', but now that we have switched to using matplotlib,
plotting is so easy that there's no point in providing those functions.
Methods inherited from nupic.network.Parameterized.Parameterized:
- __getitem__(self, name)
- Overload the [] operator to get parameter values.
- __repr__(self)
- __setitem__(self, name, value)
- Overload the [] operator to set parameter values.
- __str__(self)
- Adding a __str__ method will make str(parameterized) work.
- addParam(self, name, **attributes)
- Create a parameter with the given name and attributes.
The attributes must contain one of type, value, or default, since the
parameter must somehow determine its type. The calling syntax is the same
as Parameter.__init__.
- calculateStateFromParams()
- Override this to calculate derived state from parameters.
This is important because when saving, it is preferable to save only
parameters. Thus, upon loading (or upon changing parameters) this derived
information must be regenerated.
- getParam(self, name)
- Get the named parameter; this is NOT for getting the parameter's value.
- getValue(self, name)
- Get the value of the named parameter.
- getoptOptions(self)
- Get the getopt options for my parameters.
- hasParam(self, name)
- iterate(self, name=None, parameter=None, **iterParams)
- Iterate over the named parameter in numSteps even-sized steps from its
minimum to maximum value.
The resulting iterator iterates over copies of this Parameterized object
with different parameter values set. This makes it possible to use
recursively. It should be mentioned that all data is copied by reference,
except for the named parameter, which is duplicated in every copy.
Either the parameter should be named, or a parameter should be given to
iterate over.
Parameters
----------
name: The name of the parameter.
parameter: The parameter to iterate over.
iterParams: Extra parameters will be passed to the Parameter's
iterate method. Ordinarily, no other parameters need be passed.
- loadGetoptOptions(self, options)
- Read the parameters for my parameters from the options array while
ignoring unrelated options.
See the getopt library for more on getopt.
- loadParams(self, filename)
- Load parameters from a file.
- paramNames(self)
- Get all the names of my parameters
- printGetoptMessage(self)
- Print a list of options
- savable(self, *args, **keywordArgs)
- Create a savable copy of this Parameterized object containing just its
parameters and none of its other member data.
This is handy for saving Parameterized objects without all their messy
member data, such as generated data points or learned matrices. Saving
self, rather than savable(), can produce copious data. Of course, you
can override this to save additional data if you like.
Note: This function takes arguments and keyword arguments to pass
to the constructor of your class BUT nothing external should ever
use them. They are here to make it easy to override this method.
Suppose your class takes two non-optional parameters (param1 and
keywordParam) to its constructor. You can then easily override
Parameterized.savable() with the following code:
def savable(self):
return Parameterized.savable(self, param1, keywordParam)
- saveParams(self, filename)
- Save parameters to a file.
- setParam(self, name, param)
- Set the named parameter; this is NOT for setting the parameter's value.
- setValue(self, name, value)
- Set the value of the named parameter.
- valuesEqual(self, other, ignoredParams=[])
- Test whether the two Parameterized objects have the same parameters.
Note that this does _NOT_ check any other member data!
You should have all the important information as parameters.
Parameters
----------
other: Another Parameterized object to compare with
ignoredParams: Parameters to ignore when comparing values (e.g. one
might want to neglect the 'prefix' parameter).
Data descriptors inherited from nupic.network.Parameterized.Parameterized:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|