NeuroPype Version: 2024.1.1
Bugfix release: Fixes a path bug that prevented Experiment Recorded from launching correctly. Resolves an error message in InspectPacket node.
NeuroPype Version: 2024.1.0
Summary
This release includes a new Bayesian
package with nearly 20 nodes that allow you to build bayesian models for machine learning or deep learning classifiers (i.e., for state decoding from signals) in NeuroPype.
We've also added some additional endpoints to the NeuroPype API to load, configure and run a pipeline. (The old endpoints still work, of course.)
As always, plenty of minor improvements, bugfixes, node documentation improvements/clarifications, etc.
New Nodes
- Array package:
- CreateArray: Create an array from the given input values.
- Bayesian package:
- AtSubscripts: Apply subsampling (if any) imposed by enclosing With Stacked Variables nodes (plates) to the given data.
- BNAFApprox: A powerful variational approximation of the posterior using block-neural autoregressive flows (BNAF).
- BarkerSampler: The Barker Metropolis-Hastings sampler is a useful fallback if HMC-type samplers (eg NUTS) diverge on some geometry, but will typically be slower, especially on high-dimensional problems.
- BayesNet: Instantiate a deep network inside a statistical model.
- DerivedVariable: Capture a derived value in a statistical model under a given name.
- DiscreteHMCGibbsSampler: A hybrid discrete/continuous sampler that uses Gibbs updates to sample from discrete sites along with an underlying Hamiltonian Monte Carlo (HMC)-type sampler for the continuous variables.
- HMCSampler: The classic Hamiltonian Monte-Carlo sampler (aka Hybrid Monte Carlo) for use with MCMC inference.
- LogProbabilityTerm: Insert an additive term into the log probability of the ambient statistical model.
- MCLMCInference: Apply Bayesian inference given data and a wired-in statistical model, using the Micro-Canonical Langevin Monte Carlo (MCLMC) approach.
- MCMCInference: Apply Bayesian inference given data and a wired-in statistical model, using a Markov Chain Monte-Carlo (MCMC) approach.
- MeanFieldApprox: An approximation of the posterior that assumes that all variables are independent of each other and can each be approximated by a univariate Gaussian.
- MixedHMCSampler: The Mixed Hamiltonian Monte-Carlo sampler for use with MCMC inference.
- MultivariateNormalApprox: A multivariate normal variational approximation.
- NUTSSampler: The No U-Turn Sampler (NUTS) for use with MCMC inference.
- PosteriorModeApprox: An approximation of the posterior mode location (MAP), optionally along with a rough estimate of the variance (Laplace).
- RandomDraw: Draw a random sample from a distribution, resulting in a random variable.
- StochasticVariationalInference: Apply Bayesian inference given data and a wired-in statistical model, using Stochastic Variational Inference (SVI).
- WithStackedVariables: Context inside of which each Random Draw node behaves like a stack of N independent draws, indexed by a subscript, and where each draw appears stacked along a new axis.
- Connectivity package:
- ConnectivityMeasure: Estimate the specified connectivity measure from a previously computed MVAR model.
- Diagnostics package:
- GetDataIdentifier: Get a diagnostic identifier (string) for the given data, if available.
- HasNanOrInf: Check if the given data structure contains NaN or infinite values.
- Distributions package:
- LKJDistribution: Specify an LKJ (Lewandowski-Kurowicka-Joe) distribution of correlation matrices parameterized by dimensionality dim and a concentration η, where matrices are of shape (dim x dim).
- Elementwise_math package:
- IsReal: Return an object of the same type and shape as the data that has, for each element, a boolean value (true/false) indicating whether it a real value (as opposed to complex).
- Feature_extraction package:
- RBFKernelApprox: Approximate an RBF kernel mapping on the given data.
- Formatting package:
- SeparateStreamProperties: Selectively split properties of streams off into a separate dictionary.
- SeparateStreams: Separate streams that match a criterion from other streams.
- SplitStreams: Break up a packet into its constituent streams.
- Machine_learning package:
- ClassifierThresholdTuning: Tune the classification threshold of a predictive model so that the resulting class labels maximise a user-defined performance metric.
- KNNImputation: Impute missing data with an (optionally weighted) average of the k nearest neighbors (KNN).
- Programming package:
- ConstantArray: Create an array that can be wired into another node.
- Statistics package:
- HighestDensityInterval: Calculate bounds of the highest density interval along some axis, also known as the smallest credible interval or highest posterior density interval when applied to samples from a Bayesian posterior distribution.
New API / Engine Features
- New API endpoints for easy pipeline control:
/actions/play
,/actions/pause
,/actions/resume
,/actions/stop
- New API endpoint to easily set values on ParameterPorts in the pipeline:
/actions/configure
- The
/actions/load
API call no longer requires the {'what': 'graph'} key/value pair - The
/version
call now returns aninstall
value with the Neuropype installation folder - Logging is now separated per pipeline execution (if running multiple pipelines simultaneously, you can fetch the logs for a given pipeline only)
- More robust node processing for edge cases
- Faster performance for ML/DL operations
- Advanced NeuroPype engine settings now reside in an editable ~/.neuropype/{suite}/config.ini (these take precedence over engine/config.py).
- NeuroPype now depends on QT6 (pyside6) instead of QT5 (pyside2).
- Node ports can now assign an api_default value that is set when called directly over the API instead of a GUI client (such as PipelineDesigner).
is_training
context is now fully available to nodes, allowing them to identify when pipeline with ML/DL is in train or test mode
Node Changes / Features
- SelectRange: support for inverting the selection (i.e., selecting all elements not in the list) (lists only, not ranges)
- ExportEDF:
sample_rate
property deprecated in favor ofsample_frequency
- GetNested:
notfound
property now takes a string (i.e., raise, ignore) instead of a bool - Array nodes: support added for recursing over lists, tuples when performing linalg operations
- Elementwise nodes: robust handling of case where one or more lists are passed as operands to an n-operand node
- IsInfinite, IsNaN: new
flipped
out port added to retrieve the opposite - Step: ability to ignore either above or below thresholds (retaining original values), and to specify NaN as the replacement value
- Except: option to skip if debugger attached
- FunctionDefinition: the default argument list now contains
~
(see node docs) - EEGQualityMetrics: now returns artifact-to-signal ratio for each time point (not just session average)
- ImportCSV: support for handling of non-data rows at the top of a file
- ImportSnirf: bugfix where channel labels were misaligned
- Import/Export Structure:: support for yaml files (in addition to pickle, json)
- ImportVHDR: support for newer version of neo importer
- ConvexModel: Limited memory BFGS implementation
- CrossValidation: by default censor labels in test mode as additional safeguard against leakage
- HDCA: support for alternative robust methods and estimator types
- MeasureLoss: support for data with error bars
- TrialAggregatePredictor: bayesian logistic regression option; support for class_weights (for bayesian models)
- ArtifactRemoval: new
diagnostic_time
out port with the per-time-point artifact ratio - CommonSpatialPatterns: shrinkage, ratio CSP implementations
- AddProbeLocations (NIRS): support for providing source/detector locations via a coordinates CSV file
- CastToType: support for nested casting of types
- ExtractStreamProperty: can now extract the name of the stream
- ReplaceAxisValues: allow no substitution (removes values in search pattern); support for literal or numeric substitutions (
pattern_type
property), renamed search_expr, replace_expr properties to pattern, substitution - TopoPlotViewer: remove unused
canvas_dpi
property - RobustLDA: support for multiple batch gradient descent methods (Wiezfeld, Huber), and batch sizes
Deprecated Nodes
(none)
NeuroPype Version: 2024.0.0
Summary
Over 25 new nodes including the ability to do sleep scoring (hypnogram) from EEG data using a hidden Markov model, new machine learning / deep learning methods such as the ability to add Platt scaling to a model, create Ensemble models, use a robust loss function in Hierarchical Discriminant Component Analysis, etc. The engine has been optimized for performance and memory usage, and now supports multiple LAP solver backends. The Topoplot viewer node can now handle offline data for generating figures, and handles interpolation and contours as well (the latter thanks to Lachlan Barnes). One can now define "global" settings that can be wired in anywhere in a pipeline (very handy for large pipelines). The Neuropype Control Panel is easier to use with file pickers to select a pipeline to run or file to add to a pipeline setting. Plus lots of improvements and fixes as usual, the major ones listed below. Enjoy!
New Nodes:
- Array package:
- ArrayNonzeros: Get the indices or n-dimensional index coordinates of the non-zero entries in an array.
- DiagonalMatrix: Create a diagonal matrix from a vector or stack of vectors.
- GeometricProgression: Create an array with a sequence of numbers that follow a geometric progression.
- IdentityMatrix: Create a two-dimensional array that is an identity matrix.
- IntegerProgression: Create an array with an arithmetic progression of numbers with integer step size.
- LinearProgression: Create an array with an arithmetic progression of numbers with real-valued step size and starts/ends.
- OneFilledArray: Create an array filled with ones, optionally matching a template array in shape and optionally data type.
- ZeroFilledArray: Create an array filled with zeros, optionally matching a template array in shape and data type.
- Control_flow package:
- While: Evaluate a loop body while a condition holds.
- Elementwise_math package:
- Absolute: Take the absolute value of each element in the data.
- Machine_learning package:
- EnsemblePredictor: A model that combines outputs from multiple models trained on subsets of the data.
- ProbabilityCalibration: Calibrate continuous outputs of a method to be valid probabilities.
- TrialAggregatePredictor: A model that makes aggregate predictions based on multiple trials.
- Neural package:
- HypnogramHMM: Calculate a hypnogram (sleep scoring) from EEG using a hidden Markov model (HMM).
- ReplaceThresholdedData: Replace samples in the signal data where a separate measure (i.e., channel impedance) is outside a specified threshold.
- Programming package:
- CollectParams: Iterates over all ParameterPorts in the graph and collects their values.
- DictSplit: Break up a structure/dictionary into its key/value pairs based on their name.
- Random package:
- RandomChoice: Draw a random subset from the set of integers from 0 to a given total minus 1.
- Tensor_math package:
- AddAxisArray: Create (add) a new array (field) to an existing axis.
- OperateAxis: Perform a mathematical operation on pairs of elements in an axis and expand the data tensor along that axis to include the results.
- Utilities package:
- GetSourceFilename: Get the full path of the source of a data Packet.
- PipelineFilepath: Get the full path of the current pipeline.
- WithOptions: Collect values (i.e., pipeline parameters) from a dictionary and make them available to the entire graph or a subset, via Placeholder nodes.
Renamed/Deprecated Nodes:
- Call: Renamed
FunctionCall
. - Function: Renamed
FunctionDef
. - CreateSlice: Use Create Selection Interval instead.
- Operate: Renamed
OperateAxis
.
Node Features:
- EstimateTimeshift: support for robust mode; now defaults to 50% overlap of blocksize used
- DemixingPCA: outputs model to
model
port. - ImportSnirf: add event duration (in Duration field) to start/end markers; handle single element hdf5 datasets
- ConvexModel: performance improvements
- HierarchicalDiscriminantComponentAnalysis: support for robust (Huber) loss function; late fusion variant, improved output of class weights
- LinearDiscriminantAnalysis, LinearSupportVectorClassification, LogisticRegression, QuadraticDiscriminantAnalysis, StochasticGradientDescentClassification__, SupportVectorClassification__: streamlined handling of class weights
- __RemoveIntersectingMarkerSpans: specify markers to remove, span offsets, cumulative sum of gaps, remove non-targets within time bounds.
- ParameterOptimization: can dispatch tasks fairly across GPUs, assign tasks to specific GPUs, be use as a stateful node.
- CastToType: handle case where input is a string of "0"
- Interpolate: allow arrays of timestamps to be passed in
- Rereferencing: add option to ignore NaN values
- ReductionOperation nodes (All, Any, Centroid, etc.): more robust control over what axis should be generated; reduce over multiple streams
- Averages: added optional sum operation
- GroupedMean: added option for robust Huber mean
- ReplaceAxisValues: added support for instance axis .data['Marker'] field
- SpectrumPlot: add
xrange
property (so one doesn't need to use SelectRange prior to this node) - TopoPlotViewer: works with offline data, interpolation and contour lines options.
- BarPlot: support for statistics axes.
New Engine Features:
- Performance enhancements in the graph execution engine.
- Support for LAP solver backends other than
lapsolver
. - Development related flags can now be user-configured in
config.py
(advanced users only). - More robust handling of missing nodes in a graph.
- Reduced dependency on garbage collection (more efficient memory management).
- Added modes for memory conservation (at some modest performance cost), for low-memory compute environments.
- 0-based numbered ports in nodes (i.e.,
data0
) have been deprecated in favor of 1-based ports (data1
). - An empty graph port signature now gets normalized to
(~)
(no need to specify it in the graph signature). - Current graph file path can now be tracked (see
PipelineFilepath
node). - Wiring
this
to a node's graph (IN) port now deprecated (wire node output instead). - Block, Chunk, Packet objects no longer act as bools in conditionals (i.e.,
if block
): useany(block)
orblock is not None
).
New / Improved Resources
- Neuropype Control Panel: file picker for pipeline selection, parameters that require a filepath.
Acknowledgements
- Thank you to Lachlan Barnes at the University of Auckland (New Zealand) for contributing the contours option to the TopoPlotViewer node.