sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
8c1642b6e1f1d99f9556b602569acdb8b9eef9354700373a5e2ad15ddbf402fa | MATLAB | 4,213 | 134 | function OUT = nk_DefineFusionModeParams(dat, analysis, F, nF, curmodal, oocvind)
global FUSION PREPROC VIS STACKING
if ~exist('oocvind','var'), oocvind = []; end; varstr = [];
if ~exist('curmodal','var') || isempty(curmodal), curmodal = 1; end
stk_flag = false; if ~isempty(STACKING) && STACKING.flag == 1, stk_flag =... |
3372eff95a4bdf513d59bdec687ab7704441337db2919f6dcd21cd96db12f264 | MATLAB | 4,222 | 74 | function run_KRR_repeats(PipelineName,FCMatrix)
%% Pipeline name in format like SE:MP+24P
%% TargetBehaviour is a csv containing subjects with the Big5 + WASI-II Composite
%% FCMatrix is the FCMatrix for the pipeline whereby subjects are cols and ROIs are rows
%% Covariates contain e.g. Sex, FD
%% ... |
cc50167fbdc41a12d71aed786e67e47bb7e20978afba34726a2a3510ad36db2e | MATLAB | 4,222 | 111 | function [sY, params] = nk_MultiCentIntensNorm2(Y, V, G, B, Brange, IN, flags)
% This function performs variable normalization for multi-center studies
% Inputs:
% Y = data matrix for offset correction
% V = overlap search variable
% G = Group index vector
% B = binwidth for histogram analysis of V
if ~exist('flags','... |
43656346fafda9244e2337c34f461a7e58df18d49b7223a3af1b8ff07b9d018a | MATLAB | 4,229 | 167 | function [x,y,theta,l] = electrode_positions(electrodes,Lx,Ly)
% Retrieve the electrode positions given a cell array of electrode_positions
% Note that l=0.5 needs to correspond to 0.1995 units of distance
dscale = 0.25; % Original scaling
%dscale = 0.3990; % Circle of radius 0.1995m has area equal to half the 50x... |
607530633de08a73b550484b5ce8819aec0adfa7207ca91518d84e018ac235cf | MATLAB | 4,231 | 122 | function [ y ] = running_percentile(x, win, p, varargin)
%RUNNING_PERCENTILE Median or percentile over a moving window.
% Y = RUNNING_PERCENTILE(X,WIN,P) returns percentiles of the values in
% the vector Y over a moving window of size win, where p and win are
% scalars. p = 0 gives the rolling minimum, and p = 1... |
dc733c79f62e645bd8f7bcffb1bf7b5fde5b0e10656b16517eab0eb53fbb3f95 | MATLAB | 4,231 | 106 | function machine = train_rbm(X, h, eta, max_iter, weight_cost)
%TRAIN_RBM Trains a Restricted Boltzmann Machine using CD1
%
% machine = train_rbm(X, h, eta, max_iter, weight_cost)
%
% Trains a first-order Restricted Boltzmann Machine on dataset X. The RBM
% has h hidden nodes (default = 30). The training is performed... |
dd5b62ac74c5a71f650ae53dfb6b57f7c7d42c031f4227ed75358b27ebf8c178 | MATLAB | 4,235 | 125 | function [tv,fv,spectra,nspec,nreject] = get_tfs(t,V,window_length,fft_length,remove_artifacts)
% Calculate t,f,s based on input time and voltage
% nspec is the number of spectra that were averaged
if nargin < 5 || isempty(remove_artifacts)
remove_artifacts = true;
end
if nargin < 4 || isempty(fft_length... |
9902ccb2bc93e759d39510811417bc58ba0a74b66959fe924c5afabda4073f8d | MATLAB | 4,237 | 108 | function [cases, files, mess] = nk_DefineCaseNames2(P, N, cases_comp, mess)
if ~exist('mess','var') || isempty(mess), mess=[];end
if ~exist('P','var') || isempty(P)
fprintf('\nOperating in matrix mode.')
caseopt= nk_input('Where do I find the Subject IDs ?',0,'m', ...
'In the MATLAB(R) workspace|In a... |
c13f4511bfb4c7d22c87f27e4cf0c75bd5a455d376b1d1a6f347a49556c10971 | MATLAB | 4,247 | 131 | function [PC_results_dir, mrl, phas, pdcellids,frnm,varargout] = get_phas(event, fr_name, chanmean, rectype,group, dominantfreq,PC_win, ds, plot_win)
%GET_PHAS Phase coupling parameters
% GET_PHAS(...) loads results of spike phase coupling analysis.
%
% Input:
%
% EVENTTYPES char. array of event lab... |
641eb1eda6c67d99fee7765027228af092095a0f973371771445fe8e24aa16c8 | MATLAB | 4,257 | 117 | function [ipos, ind0] = nk_FindGridOpt(tr, ts, c, action, perc)
%
% function [xpos, ypos] = nk_FindGridOpt(tr, ts, c, action, alttest)
%
% This function determines the optimum C and kernel parameters after the
% grid computations have been finished. It can be used for binary /
% multi-class or regression model optimiz... |
909a69d2f43253290cfea13c31f06a6762b0c19a6a8c2bfb4442aeec75c6672d | MATLAB | 4,270 | 181 | function vargout = nk_FigSetup2(fl)
if nargin < 1, fl = 'all'; end
% ***************************** FIGURE SETUP ******************************
switch fl
case 'cv1test'
vargout{1} = check_cv1test;
case 'bestcv1test'
vargout{1} = check_bestcv1test;
case 'cv2test'
vargout{1} = che... |
1142599246a3584a842fcf49b4376e6510195a0c5bbb613234e67980c0f741eb | MATLAB | 4,281 | 111 | function [sY, params] = nk_MultiCentIntensNorm2(Y, V, G, B, Brange, IN, flags)
% This function performs variable normalization for multi-center studies
% Inputs:
% Y = data matrix for offset correction
% V = overlap search variable
% G = Group index vector
% B = binwidth for histogram analysis of V
if ~exist('flags','... |
bf5f86f13b75cd5918e5f053d113d6572c0664fb8a53f9d25a899c551135085c | MATLAB | 4,288 | 120 | function [Y, Thresh] = nk_ReturnSubSpaces(V, Vm, n_samples, n_subjects, Thresh, reportfile)
% ===============================================================================
% function [Y, Thresh] = nk_ReturnSubSpaces(V, Vm, n_samples, n_subjects, Thresh)
% ==============================================================... |
45c7d6a5e9eb0d43c2c8cd9cc8a72b5cf222e2c94d505ac1f8a1ccb88e9d5d2b | MATLAB | 4,289 | 167 | function result = cvMcd(data,kmax,resMCD,h)
%CVMCD calculates the robust cross-validated PRESS (predicted residual error sum of squares)
% curve for the MCD method in a fast way.
%
% Input arguments:
% data : the full data set
% kmax : the maximal number of components to be considered (mostly kmax = p).
% ... |
ab214526755f4db5ec5e29e8abff853eeea9fe577025a3bf94a1e10adde15852 | MATLAB | 4,290 | 138 | function [count edges mid loc] = histcn(X, varargin)
% function [count edges mid loc] = histcn(X, edge1, edge2, ..., edgeN)
%
% Purpose: compute n-dimensional histogram
%
% INPUT
% - X: is (M x N) array, represents M data points in R^N
% - edgek: are the bin vectors on dimension k, k=1...N.
% If it is a scalar ... |
2430b73c3060ac80ac5f02abfe7e1d01ef5f11b048e07d5cf4e8375d0c9fa426 | MATLAB | 4,297 | 108 | clear
%%
load('ProcessedData\InputParameters.mat');
load('ProcessedData\OutputTable.mat');
%% Pre-Processing
% any manual trimming of the main table or adjustments
% exmaple to drop to one animal or day
% OutputTable = OutputTable(strcmp('LEC285598', OutputTable.Animal) == true,:);
% OutputTable = Out... |
aa604fca044a1e54661150307a46bf4015209c457e297a957aea6f7d585c9a8d | MATLAB | 4,311 | 88 | function [MBM] = mbm_perm_test_beta(statMapNull, MBM)
% permutation tests on the beta spectrum
%
%% Inputs:
% statMapNull - Matrix of rows of null statistical maps
%
% MBM - structure having the input fields:
% MBM.eig.nEigenmode - Number of eigenmodes to be used.
%
% MBM.eig.... |
0885b249d317b97ff965bd1d56f8e88a89cd0433af20b133fe482ff3fe02e149 | MATLAB | 4,312 | 105 | clear
%% load PreProcessed file
load('ProcessedData\PreProcessed_behaviorShifter_smoothed_retuned_firstPeak_021726.mat');
%% Re-org deltas and drop lost trials so dataset has no missing values
% intialize empties and parameters
tables_compiled = cell(1,5);
trial_cutoff = 8; % number trials to keep for downs
... |
85171f49f071d90e085f21aedfe2ac1434d60c6b7bfd5b3f1e38ecdd560bc9e1 | MATLAB | 4,323 | 124 | function [id, rect, shader] = CreateProceduralPolarGrating(windowPtr, width, height, ...
color1, color2, radius)
% [id, rect, shader] = CreateProceduralPolarGrating(windowPtr, width,
% height [, color1=[1 0 0]] [, color2=[0 1 0]] [, radius=0])
%
% A procedural color grating shader that can generate either sinusoidal ... |
56465869621bb7c8cb09bfd167039eeb06401561a31f6b71c3f50c5dd165077f | MATLAB | 4,324 | 149 | function [x, infos] = asag_mu_nmf(V, rank, in_options)
% multiplicative update for non-negative matrix factorization (SAGA-MU-NMF) algorithm.
%
% Inputs:
% matrix V
% rank rank
% options options
% Output:
% w solution of w
% infos information
%
% References:... |
1bbe782e23a4303518b1d50e9863a86398b96cbc3612ab5473f50dc3f06b9d1f | MATLAB | 4,333 | 153 | % clear; clc;
load('...\LFPdata_FigS4.mat')
fs=LAT.fs;
t_start=LAT.t_start;
t_end=LAT.t_end;
saveFig=0;
% JA of Mk1/Mk2 (signals recorded simultaneously)
[allDiffLAT_P1Go_ja,allDiffLAT_N1Go_ja,allDiffLAT_P1MovOn_ja,allDiffLAT_N1MovOn_ja,allRT1_ja,allRT2_ja,allDiff_RT_ja,allBestLag_rVal_ja,allICD_lat]=f_Cal... |
14b0c30f10f3365beeab5b9989f9038463a2e086f75825635c4001626a4642ae | MATLAB | 4,334 | 141 | function [eigvector, eigvalue, bSuccess, elapse] = OLPP(W, options, data)
% OLPP: Orthogonal Locality Preserving Projections
%
% [eigvector, eigvalue, bSuccess] = OLPP(W, options, data)
%
% Input:
% data - Data matrix. Each row vector of fea is a data point.
% W ... |
acc3e98ce2d302c16e52db6554be0475d65abbfe15f2493b868f0498f1a90a18 | MATLAB | 4,335 | 100 | %% ================================================================
% Script: hierarchical_clustering_dHCP_comparison.m
% Purpose:
% Compare neonatal FOCA hierarchical structure with adult-derived
% clustering organization (MSC reference).
%
% Description:
% - Compute neonatal FOCA matrix from individualiz... |
88a846cfc5a709a5fec76154ef2a81e836aaada30a331769ac586e30c515da73 | MATLAB | 4,338 | 149 | function [W, info] = MTFLC_ADMM(X, y, lambda1, lambda2, opts)
%
% Multi-Task Feature Learning with Calibration - ADMM
%
% OBJECTIVE
% min_W { sum_i^m ||Xi wi - yi|| + lambda1 ||W||_{1,2} + lambda2/2 ||W||_F^2 }
%
% We use ADMM to solve the problem.
%
% INPUT
% X - cell array of {n_i by d matrices} by m
% y - cell ... |
91bf78cd72ecddc922f8bddc1c4beac22667641228a2851daf65ec3e178c7745 | MATLAB | 4,338 | 108 | % ==========================================================================
function [out, param] = nk_matLearn_IO_config(opt, param, ind, mode)
out = [];
if isempty(opt) || ~isfield(opt,'desc'), return; end
if exist('ind','var') && ~isempty(ind) && iscell(opt.desc)
if ind>numel(opt.desc), return, end
desc =... |
f03db84fd0ec957ef4fb46f7927af37c7ad3bf7fead1316395af981e0c06ecfd | MATLAB | 4,376 | 118 | function [sY, IN] = nk_PerfRemMeanDiffObjOld(Y, IN)
% =========================================================================
% FORMAT function [sY, IN] = nk_PerfRemMeanDiffObj(Y, IN)
% =========================================================================
% Normalizes given data (specified ind dIND) to global mea... |
f8170faedeb4ca36eac55315c4b9ee4bf0c94147fe0c62b97b637876d2ff8d06 | MATLAB | 4,377 | 163 | function varargout=shadedErrorBar(x,y,errBar,lineProps,transparent)
% function H=shadedErrorBar(x,y,errBar,lineProps,transparent)
%
% Purpose
% Makes a 2-d line plot with a pretty shaded error bar made
% using patch. Error bar color is chosen automatically.
%
% Inputs
% x - vector of x values [optional, can be left em... |
2cd491de8ab3055b98b55301e072abc4df429dd5f14704d4d1fb457234e9d833 | MATLAB | 4,380 | 149 | classdef sendSerialIOPort < handle
%SENDSERIAL Connects and manages Serial port communication
% Connects and manages Serial port communication
properties
name = '/dev/ttyUSB0'
baudRate = 115200
silentMode = 0 %this allows us to be called even if no serial port is attached
verbosity = 1
openNow = false %a... |
de14fdcaa358bb0e71c8979ea31bc829d0b06a9c8649a47eeb5f26e2658da38e | MATLAB | 4,380 | 121 | function similarity = dice(A,B)
%DICE Sorensen-Dice similarity coefficient for image segmentation.
%
% SIMILARITY = DICE(BW1,BW2) computes the Sorensen-Dice similarity
% coefficient between segmented objects in binary images BW1 and BW2.
% SIMILARITY is a scalar double in [0,1]. A SIMILARITY of 1 means that
... |
6913ffd99c3f1299d05cfb5affdc61ca50279e038a0d71ae724d6e56f4e36a8e | MATLAB | 4,381 | 119 | classdef spatial_emg < bt.model.template_spatial
% This is a template function that allows rapid prototyping of new spatial
% fitting by leveraging model.params.spatial_spectrum with absolutely
% no regard for performance
properties
% No new properties required by this derived class
end
methods
function sel... |
34152d8859b86d8b336f78f2eb8745e10c2229c6028850c2414946b05d4250c1 | MATLAB | 4,383 | 122 | function [discid, discrect] = CreateProceduralSmoothDisc(windowPtr, width, height, backgroundColorOffset, radius, sigma, useAlpha, method)
% [discid, discrect] = CreateProceduralSmoothDisc(windowPtr, width, height
% [, backgroundColorOffset =(0,0,0,0)] [, radius=inf] [, sigma=11] [,useAlpha=1] [,method=1])
%
% Creates... |
483716f944e5eeccb4723437b30a5542cba1a86f7a17602b63cbb8e148d8daac | MATLAB | 4,390 | 134 | function [AtA,Y,numIter,tElapsed,finalResidual]=kernelsparseseminmfnnls(X,k,option)
% Kernel semi-NMF based on NNLS: phi(X)=A_phiY, s.t. Y>0.
% Definition:
% [AtA,Y,numIter,tElapsed,finalResidual]=kernelsparseseminmfnnls(X,k)
% [AtA,Y,numIter,tElapsed,finalResidual]=kernelsparseseminmfnnls(X,k,option)
% X: matr... |
4d6d1bef82978cd965ba39cfb554e7d77b621aa22ed5909b8d8f71a230504754 | MATLAB | 4,391 | 127 | function CM = cv_graph_constructionREFPLUSP(A, ~, referenceGroup, similarityMeasure)
% Jackknife Bias Estimation for network construction (Das et al., 2018)
%
% INPUT: matrix format, dimensions: n people x m features
%ƒ
% Steps:
% 1. compute reference network from reference group provided
% (referenceGroup)
% 2... |
0887bd0f29c19d7e42c6ad19a54e497ca24eb20c86cad9308f13d7fc69e89308 | MATLAB | 4,402 | 106 | function [testClassPredicted]=nmfClassifier(trainSet,trainClass,testSet,testClass,option)
% NMF classifier.
% Usage:
% [testClassPredicted]=nmfClassifier(trainSet,trainClass,[],testClass)
% [testClassPredicted]=nmfClassifier(trainSet,trainClass,testSet,testClass)
% [testClassPredicted]=nmfClassifier(trainSet,trainClass... |
9049e192ce71d8881816d43289a3f97f6ba245ee20bf717fc472c8b4e7c4e300 | MATLAB | 4,405 | 141 | function [AtA,Y,numIter,tElapsed,finalResidual]=kernelseminmfnnls(X,k,option)
% Kernel semi-NMF based on NNLS: phi(X)=A_phiY, s.t. Y>0.
% Definition:
% [Ak,A,Y,numIter,tElapsed,finalResidual]=kernelnmfrule(X,k)
% [Ak,A,Y,numIter,tElapsed,finalResidual]=kernelnmfrule(X,k,option)
% X: matrix of mixed signs, datas... |
9a00caf1a290234a35ab81dead236835400d09bed3f41c2aef0843fedf481f10 | MATLAB | 4,411 | 84 | function OOCVinfo = nk_GetOOCVInfo(NM, searchmode)
if ~exist('searchmode','var') || isempty(searchmode), searchmode = 'oocv'; end
OOCVinfo.searchmode = searchmode;
AS = nk_GetAnalysisStatus(NM);
if AS.analcompleteflag >0 && AS.oocvappflag
OOCVinfo.AnalVec = find(AS.completed_analyses);
OOCVinfo.n_AnalCo... |
77e42c25043ee02140abb1d50685cfc49ae61d0b65d9ce510a1e1590fe765d1c | MATLAB | 4,413 | 137 | function [K,runtime]=untilpRWkernel(Graphs, p, small, intermediate, name)
% Compute a labeled p-step random walk kernel for a set of graphs
% Copyright 2012 Nino Shervashidze
% Input: Graphs - a 1xN array of graphs
% Graphs(i).am is the adjacency matrix, Graphs(i).nl.values is a column vector of node labels.
% ... |
f8e256e936fee8daab4dedf13a5674b5f5af765ecd1e55195342de5ce63a36f5 | MATLAB | 4,415 | 159 | %% FUNCTION Least_msmtfl_capL1
% Multi-Stage Multi-Task Feature Learning
%
%% OBJECTIVE
% min_W ||XW - Y||_F^2 + lambda*\sum_i \min{||W^i||_1,theta}
%
% It's a nonconvex optimization problem, which can be relaxed into a Multi-Stage Convex optimization:
% min_W ||XW - Y||_F^2 + \sum_i{gamma_i*||W^i||_1}
%
%% INP... |
69d002ea9b164511246a06f19f8f4cb76f8ee89ef2a92907eb1418ae88c59b14 | MATLAB | 4,420 | 113 | function A = allcomb(varargin)
% ALLCOMB - All combinations
% B = ALLCOMB(A1,A2,A3,...,AN) returns all combinations of the elements
% in the arrays A1, A2, ..., and AN. B is P-by-N matrix where P is the product
% of the number of elements of the N inputs.
% This functionality is also known as the Cartesia... |
0ee14307376fbe1acc179ab98da0db192789a6e13c5ed52cc9ee01778bf37cf8 | MATLAB | 4,424 | 139 | function result=cpca(x,varargin)
%CPCA performs a classical principal components analysis
% on the data set x. The loadings correspond with the eigenvectors of the
% classical covariance matrix of x.
%
% Required input argument:
% x : Data matrix (observations in the rows, variables in the
% columns)
%... |
ad5dfbba6103e9b015bbd698d9fa4507feac4f4fcaf7b94e4f4c67d8e97438d7 | MATLAB | 4,424 | 138 | function PD_ssrt_behav_MAIN(conditions, all_groups)
% PD_SSRT_BEHAV_MAIN Main function for behavioural analysis of Stop Signal
% Reaction Time task of Parkinsonian patients implanted with deep brain
% stimulator.
%
% Input parameters:
% CONDITIONS Nx2 cell array of task conditions to compare
% ... |
3b46ebfcd9a26ea270281fead7087619472ca66f09ceadc22c3756bd7d7fdd50 | MATLAB | 4,426 | 138 | % SB2_CONTROLSETTINGS Set parameters to control the SPARSEBAYES algorithm
%
% CONTROLS = SB2_CONTROLSETTINGS
%
% OUTPUT ARGUMENTS:
%
% CONTROLS A structure whose fields control various aspects of the
% running of the SPARSEBAYES algorithm.
%
% .ZeroFactor Small number equivalent to zero for Q^2-S
% .MinDeltaLog... |
a8f9135023782d9535570cba0b2d52536d0bb5476831a0c95ca456947bb418ea | MATLAB | 4,426 | 101 | function [I,Q,F]=motif3funct_wei(W)
%MOTIF3FUNCT_WEI Intensity and coherence of functional class-3 motifs
%
% [I,Q,F] = motif3funct_wei(W);
%
% *Structural motifs* are patterns of local connectivity in complex
% networks. In contrast, *functional motifs* are all possible subsets of
% patterns of local con... |
10dafa4ac397dcd5220228e9c0a087b87433f1cc907d2749558f6c48b89b91ee | MATLAB | 4,436 | 121 | function [count] = countall4graphlets(L)
% Count all 4-node subgraphs in an undirected graph
% without node labels and with unweighted edges
% Author: Nino Shervashidze - nino.shervashidze@tuebingen.mpg.de
% Copyright 2012 Nino Shervashidze
% Input: L - 1xn cell array - corresponding adjacency list
% Output: cou... |
f5dadab9763ad6d7bac29f973c17f0e792273060319823c1e568b2743a5cbf97 | MATLAB | 4,442 | 144 | function [x, infos] = sparse_nmf(V, rank, in_options)
% Sparse Nonnegative matrix factorization (sparseNMF)
%
% The problem of interest is defined as
%
% min D(V||W*H) + lambda * sum(H(:)),
% where
% {V, W, H} > 0.
%
% L1-based sparsity constraint on H.
% Normalizes W column-w... |
cbd9e973158467b1911280b302c412acac60c6b41729c2ea6d32355c9d3da9c3 | MATLAB | 4,443 | 146 | function PD_wav(sess2analyse,choi,varargin)
%PD_WAV Wavelet transform of all data
% Applies wavelet transformation (see eegwavelet2) to preprocessed epoched data (see preprocess_PD).
% Trial data are concatenated and zscored prior to transformation
% (wavelet analysis is based on the code of Christopher Torrenc... |
d4eb0107e6020ebb7dccc94f33fac921f2e762d18fd0754f4c8d336fdb3d4a03 | MATLAB | 4,445 | 61 | %-----------------------------------------------------------------------
% Job saved on 18-Dec-2020 11:29:19 by cfg_util (rev $Rev: 7345 $)
% spm SPM - SPM12 (7771)
% cfg_basicio BasicIO - Unknown
%-----------------------------------------------------------------------
matlabbatch{1}.cfg_basicio.file_dir.file_ops.file_... |
e67b17b0762edf48ebe01cd67de82717e764941c2ddc902fe7de586a8781a8e8 | MATLAB | 4,469 | 145 | function stats = rm_anova2(Y,S,F1,F2,FACTNAMES)
%
% function stats = rm_anova2(Y,S,F1,F2,FACTNAMES)
%
% Two-factor, within-subject repeated measures ANOVA.
% For designs with two within-subject factors.
%
% Parameters:
% Y dependent variable (numeric) in a column vector
% S grouping variable for... |
b4392dbb046c2eb5f3f82fffcd9d9c01824c9fd121894c9e060642156658e930 | MATLAB | 4,510 | 120 | function [mappedX, mapping] = fastmvu(X, no_dims, k, finetune, eig_impl)
%FAST_MVU Runs the Fast Maximum Variance Unfolding algorithm
%
% [mappedX, mapping] = fastmvu(X, no_dims, k, finetune)
%
% Computes a low dimensional embedding of data points using the Fast
% Maximum Variance Unfolding algorithm. The data is spe... |
cd77e8e4d1f9fbe7a1906b84ba48c062097290995cf787d4f61b19ff88ee689b | MATLAB | 4,514 | 152 | function [FR,HighNoiseIDX] = convolve1D(rawFluor,fps,dSFactor)
% Function to calculate the putatiuve activity of neurons recorded through
% calcium imaging algorithm.
%
% INPUTS:
% rawFluor: m x n matrix, with "m" time series and with "n" datapoints
% each. Usually the neuron.C_ray from the CNMF-E algorithm.
% f... |
890105171973940ccdd206270eb8b8e0445124bf1e28d667c0e7ad9386bf70fb | MATLAB | 4,518 | 133 | function [f, ax, ax2] = barMLI(casenum, MLIcont, feats, refdata, sortfl, uiaxes, uiaxes2, col1, col2) %newdata
if exist('uiaxes','var')
ax = uiaxes;
f=0;
else
f=figure;
f.Position = [100 100 750 750];
ax = gca;
end
hold(ax,'on');
nF = numel(feats);
y = MLIcont.Y_mapped(casenum,:);
y_ciu = MLIcont.... |
f9a1c08ba818e75ee96f7bafa0ad55113052bd970932dead67a32f3f08eac8fa | MATLAB | 4,520 | 134 | % test the sparse updates of augmented Lagrange.
function [] = testMatrixMultiply2()
clc;
data = [2 3 4 5 6 ];
Known = [1 11 13 20 44];
m = 5; n = 10; r = 3;
[Ik, Jk] = ind2sub([m n],Known);
S_data = sparse(Ik, Jk, data, m, n);
rho = 0.5;
% initially S_comp = empty. X0 = U0*V0 + S_comp
S_comp = sparse(Ik, ... |
3f2f484ebaf33696b0f0ad52425fbc5ba6779750da5d35fbb23dddecb88606ce | MATLAB | 4,522 | 127 | % this script reads all the spike timestamp and a/d info from a plx file into matlab
% variables.
% Open a plx file
% this will bring up the file-open dialog
StartingFileName = '';
%StartingFileName = 'c:\plexondata\NSSample.plx';
%StartingFileName = 'c:\plexondata\au101602a.plx';
[OpenedFileName, Version, Freq, Comme... |
92187db928f030fb14fff30c70bbc9ce5dd327a14e9ac382bed37f4ad1d2fe10 | MATLAB | 4,525 | 150 | % =========================================================================
% Coded by Youngmin Ha (y.ha.1@research.gla.ac.uk) on 21 Jan 2015
% =========================================================================
% This program demonstrates multivariate relevance vector regression (MRVR).
% A user can choose eit... |
dba1569195c08017a1d16a0073fdfe9480b8d70b057e9c2dca1fd5c585694999 | MATLAB | 4,533 | 109 | function [weights, idx_feat, score] = gflipOneTime(X_train, Y_train, extra_param, cpus, labelsSet)
% [idx_feat, score] = gflip_incdists(obj1, X_train, Y_train, extra_param);
%
% input: X_train(i,j) is the value of feature j in training instance i.
% Y_train(i) is the label of training instance i.
% extra... |
0e403f76cdb93004e66ec7ba2efab896f6e109b2c148ec70710c9d37bce0aea3 | MATLAB | 4,534 | 115 | function BootstrappingPlotter(outputs,savenclose)
if nargin < 2
savenclose = 0;
end
fldnames = fieldnames(outputs);
for k = 1:length(fldnames)
tempstruct = outputs.(fldnames{k});
subfldnames = fieldnames(tempstruct);
if length(subfldnames) > 1
niters = length(subfldnames)-1;
param_fit ... |
b05ff88fa093e98ab314cd11036d34fe2a0566436b4ddb35b33b804627075540 | MATLAB | 4,553 | 65 | %% AEC (Amplitude Envelope Correlation) Analysis Batch
% Computes orthogonalized envelope correlation on source-level data
% using Schaefer 100-parcel (7-network) atlas in Brainstorm.
%% ===== USER SETTINGS =====
reports_dir = '/path/to/reports';
subjects = 1:20;
% ==================================================... |
49a04fbb43d65d301ddfbebfa2eb26c15b39c544ca2b771b8e72ba35d9db664f | MATLAB | 4,560 | 115 | function [sY,IN] = cv_graph_PerfGraphMetrics(Y,IN)
% =========================== WRAPPER FUNCTION ============================
if ~exist('IN','var'), IN = []; end
if iscell(Y)
sY = cell(1,numel(Y));
for i=1:numel(Y), [sY{i}, IN] = PerfGraphMetrics(Y{i}, IN); end
else
[ sY, IN ] = PerfGraphMetrics(Y, IN);
... |
0a0e90ddc09121770d44ec30e922feb201297a95c99bbf576eb5cbb05ae61f8a | MATLAB | 4,574 | 112 | %% msBatchRun2018
% Version 1.0 GE
% Updated version of the msBatchRun script originally proposed by Daniel B
% Aharoni to analyse miniscope 1p calcium imaging data on large batches of
% data.
% This version is build on top of the original package to maximize compatibility.
% It includes NormCorre for image registratio... |
ed466e4a5a727372ad8c66e49edb9a6fdfd276e531d935e0594871c8713089d6 | MATLAB | 4,591 | 157 | function demo_nenmf_clustering()
%
% demonstration file for NMFLibrary.
%
% This file illustrates how to use this library.
% This demonstrates a clustering application of NeNMF algorithms as well
% as multiplicative updates (MU), Hierarchical ALS, and GNMF algorithms.
%
% This file is part of NMFLibrary.
%
% Created ... |
490c9aa5cdfa97325a88653813a8dda4cc8b1aa2070ff57dd6f43c2389e1a52b | MATLAB | 4,603 | 151 | function palm_hemisplit(varargin)
% Split back bh into lh and rh for files that have previously
% been merged with palm_hemimerge.
% Output file names have prefix "lh" and "rh".
%
% palm_hemisplit [-v #vtx] [-f #fac] <files>
%
% Wildcards are accepted.
%
% -v <nV> : Specify the number of vertices for the left hemispher... |
7f14d57f830d9934296bd38e9da78408f494bb5457740cfb2a5d7c50f382b7e8 | MATLAB | 4,614 | 128 | % =========================================================================
% = PIE CHARTS =
% =========================================================================
function [h1pie, h2pie] = display_piecharts(handles, Pre1, contigmat, labelh)
GraphType = ge... |
f8b8ceb21d8fc4d9f7b4f63216dd87c3e10e3bf7a5e67214a34b497aad557ed4 | MATLAB | 4,616 | 151 | function [AtA,Y,numIter,tElapsed,finalResidual,A]=kernelSparseNMFNNQP(X,k,option)
% Kernel semi-NMF based on NNQP
% Usages:
% [Ak,Y,numIter,tElapsed,finalResidual]=kernelSparseNMFNNQP(X,k)
% [Ak,Y,numIter,tElapsed,finalResidual]=kernelSparseNMFNNQP(X,k,option)
% X: matrix of mixed signs, dataset to factorize, e... |
69eab04ab5e5f750d21dbcd34b285828fe7fe19d9d57420b3fed742e026d0fad | MATLAB | 4,633 | 71 | function RasterStructure = getRasters(a)
%Reads a plx file and obtains the recording raster and signals
%Save any comments in the file
RasterStructure.Comment = a.Comment;
%Find the total gain
RasterStructure.ExperimentTotalGain = [a.SpikeChannels.Gain].*a.SpikePreAmpGain;
TS = {a.SpikeChannels.Timestamps};... |
2f72334c05c858013b9ac4cc3f06dcf1bbe518201b7c0a7ffa9f7d4cef99c088 | MATLAB | 4,634 | 133 | function [mappedX, mapping] = lle(X, no_dims, k, eig_impl)
%LLE Runs the locally linear embedding algorithm
%
% mappedX = lle(X, no_dims, k, eig_impl)
%
% Runs the local linear embedding algorithm on dataset X to reduces its
% dimensionality to no_dims. In the LLE algorithm, the number of neighbors
% can be specified... |
db32c89af4785a7dc3e05417499927cda90f921ae6044b9dab44adf79626e6da | MATLAB | 4,652 | 116 | function [weights, idx_feat, score] = gflipOneTime_gpu(gX_train, Y_train, extra_param, glabelsSet)
% [idx_feat, score] = gflip_incdists(obj1, X_train, Y_train, extra_param);
%
% input: X_train(i,j) is the value of feature j in training instance i.
% Y_train(i) is the label of training instance i.
% extra... |
b1e221fbc707e876936a9dbd7c2854d05e119aaa677b4e414f0d64cfc0f5d96d | MATLAB | 4,657 | 191 | % Test file for Probablistic NMF algorithms
%
% Created by H.Kasai on May 20, 2019
clc;
clear;
close all;
pnmf_vb_flag = 1;
pnmf_vb_ard_flag = 1;
nmf_mu_flag = 1;
nmf_hals_flag = 1;
%% load CBCL face datasets
% fprintf('Loading data ...');
%V = importdata('../../data/CBCL_face.mat');
V = dlmread('../../data/R.txt')... |
d8dd1e3152485b0341a0fec9e2541cb4b6e6d0cb8f825b8fbadd00eddf6aab14 | MATLAB | 4,682 | 133 | classdef tittaAdvImageStimulus < handle
properties (Access=private, Constant)
calStateEnum = struct('undefined',0, 'showing',1, 'blinking',2)
end
properties (SetAccess=private)
calState
pointStartT
blinkStartT
end
properties (Dependent, SetAccess=private)
pos ... |
01029a63d086ccbef67c14c81c7122ae324b87e4058425fa0eb3057233bd0313 | MATLAB | 4,691 | 111 | function [machine, err] = train_grbm(X, h, eta, max_iter, weight_cost)
%TRAIN_GRBM Trains a Gaussian Restricted Boltzmann Machine using CD1
%
% [machine, err] = train_grbm(X, h, eta, max_iter, weight_cost)
%
% Trains a first-order Restricted Boltzmann Machine on dataset X. The RBM
% has h hidden nodes (default = 30).... |
a8a3e08835b2451dca8ab3f029c66ef13bd833ec30180bedbe943339bc7106aa | MATLAB | 4,698 | 135 | function [predicted,memberships, numhits] = fknn(data, labels, test, ...
testlabels, k_values, info, fuzzy)
% FKNN Fuzzy k-nearest neighbor classification algorithm.
% Y = FKNN(DATA, LABELS, TEST, TESTLABELS, K, INFO) Runs fuzzy
% k-nearest neighbors on the given data. DATA is a N-by-D data matrix
% consisting ... |
fbbc6c989a1769d26d28c711e0ee2da6a8cafd00788db6cb4632478bcda8a3f4 | MATLAB | 4,704 | 128 | % M. H. Van Benthem and M. R. Keenan, J. Chemometrics 2004; 18: 441-450
%
% Given A and C this algorithm solves for the optimal
% K in a least squares sense, using that
% A = C*K
% in the problem
% min ||A-C*K||, s.t. K>=0, for given A and C.
%
function [K, Pset] = kfcnnls(C, A,option)
% NNLS using normal e... |
72f126f338c331dbf7e0f0744cf1a3975f63d9609c7eb7a17f1b1f4957dcb219 | MATLAB | 4,709 | 111 | function mappedX = fast_tsne(X, no_dims, initial_dims, perplexity, theta)
%FAST_TSNE Runs the C++ implementation of Barnes-Hut t-SNE
%
% mappedX = fast_tsne(X, no_dims, initial_dims, perplexity, theta)
%
% Runs the C++ implementation of Barnes-Hut-SNE. The high-dimensional
% datapoints are specified in the NxD matri... |
e39e1b32119c830cdfd1a296b949bf2f48240db1ccfcb472053efcff9db0a9b3 | MATLAB | 4,710 | 157 | function [P, Y] = nk_FSreslice(S,P)
Y= [];
if ~exist('S','var') || isempty(S)
S = spm_select(Inf,'dir','Specify directories/list of subjects to work on');
[S,SDIR] = spm_str_manip(S,'c');
if ~exist(fullfile(SDIR,deblank(S(1,:))),'dir')
SDIR = spm_select(1,'dir','Specify FREESURFER subject director... |
2cefc20e19895c36551ae49aaeb71bc78c35e462b631b28a6e927d7f70399491 | MATLAB | 4,714 | 144 | function [unsrtR,S,srtR] = palm_competitive(X,ord,mod)
% Sort a set of values and return their competition
% ranks, i.e., 1224, or the modified competition ranks,
% i.e. 1334. This makes difference only when there are
% ties in the data. The function returns the ranks in
% their original order as well as sorted.
%
% U... |
c73be4796159ccb480e71e6ee9b6c302af74c9698321730cea0378db8f39958a | MATLAB | 4,716 | 118 | %power RT (single and clustered)
%This version: 200903 by poem
%% set parameters (initialize)
clear all;
SL = '\';
FilePath = '';
if isunix
mypath;
FilePath = '~/liang/RS/'; %directory
SL = '/';
end
DR_PBase_setup; %load setup file
%datasets
PLOT_SET = {
's01_061102'; %motionless
... |
8ccfa12c82c7fc26317014381b02fb1fee6172962be53b882ac534f4e6e373c8 | MATLAB | 4,724 | 147 | function [x, infos] = nmf_hals_so(V, rank, in_options)
% Orthogonal multiplicative updates (MU) for non-negative matrix factorization with soft orthogonal constraint (NMF-HALS-SO).
%
% The problem of interest is defined as
%
% min || V - WH ||_F^2,
% where
% {V, W, H} >= 0, and W is ortho... |
7ade525425cbbaeedbef0737112992c93d23c84d53ffce649d371a476335a778 | MATLAB | 4,735 | 105 | function mbm_check_read_inputs(MBM, inputMap)
% Read inputs for analysis from file paths given in MBM.
%
%% Input:
% MBM - structure having the fields:
% MBM.maps.anatListFile - Character vector.
% - Path to either:
% ... |
c89d8dee8a4e0be35a7700d582a07f58dd13c49a43c5b8036e2ca136c2431c64 | MATLAB | 4,736 | 93 | % =========================================================================
% = CONTINGENCY MATRIX INFO =
% =========================================================================
function handles = display_contigmat_app(handles, contigmat)
contig=[];
GraphType = get(ha... |
d343cc33405e6848162f60e055c20b39c17850e03f4259bad6cee95154d1aeb3 | MATLAB | 4,745 | 169 | <<<<<<< HEAD
function M = stl_read(filename)
% Read STL-formatted data from disk
% FORMAT M = stl_read(filename)
%
% filename - STL-formatted file name
% M - data structure
%__________________________________________________________________________
%
% STL Format Specification:
% https://en.wikipedia.o... |
5bee235a90a047900559654a43f1683f5a2bb5c10adeceeb3f5df36fed26a636 | MATLAB | 4,751 | 96 | function IND = determine_search_location(A,method,params)
% determine the search location for updating each spatial component
% INPUTS:
% A: current estimate of spatial component ( d x nr sparse matrix)
% method: method to be used of determining search locations
% available methods:
% 'ellipse': dra... |
ebb2cbdb1eb95f87f1e7072b02e0ea2d5355722bc3f7a7de8510617c4c43d2f8 | MATLAB | 4,757 | 117 | function [faces, vertices, vertexColors, data] = readMz3(filename, isForceRGBA2RGB)
%function [faces, vertices, vertexColors, data] = readMz3(fileName)
%inputs:
% filename: the nv file to open
% isForceRGBA2RGB: (optional). If true (default) then 4-component RGBA and 5-component RGBA+scalar are read as RGB only
%out... |
22fcc67aa541a657203183d6b78997725ea5e893b393b732672401bd3449227b | MATLAB | 4,758 | 133 | function [X,Z,eCm,eCx] = palm_partition(M,C,meth,Y)
% Partition a design matrix into regressors of interest and
% nuisance according to a given contrast.
%
% Usage
% [X,Z] = palm_partition(M,C,meth,Y)
%
% Inputs:
% M : Design matrix, to be partitioned.
% C : Contrast that will define the partitioning.
% meth : Me... |
34f42d935b6749f3d829c3decdf79bfd28f993961d125e24d6bd6a759933561d | MATLAB | 4,758 | 127 | function sigArray = periEventSigArray(dn,behEvtTbls)
% This functions organizes ca signals into an periEvent array
% Inputs:
% dn: ca signal structure
% .ca: calcium signal matrix: nFrame x nCell
% .time: timestamps of each frame
% .sttFrameT: table for the start time of each session of interes... |
56dcf7877b9e577bebc5a7276dd6c5804ec6699db7bd462bc2de5b2d6241e164 | MATLAB | 4,758 | 172 | function [eigvector, eigvalue, elapse] = MMP(gnd,feaLabel,feaUnlabel,options)
% MMP: Maximum Margin Projection
% Semi-supervised version of LSDA (Locality Sensitive Discriminant Analysis)
%
% [eigvector, eigvalue, elapse] = MMP(gnd,feaLabel,feaUnlabel,options)
%
% Input:
% gnd ... |
e11edee1c07e17fca7d5314bf1aeffcd40acc48357882133930ef90cea798893 | MATLAB | 4,787 | 133 | classdef Net < handle
% Wrapper class of caffe::Net in matlab
properties (Access = private)
hNet_self
attributes
% attribute fields
% hLayer_layers
% hBlob_blobs
% input_blob_indices
% output_blob_indices
% layer_names
% blob_names
end
properties (S... |
151a90a94bca93cc0a58f23203248e44559339f6de6b08236320b50bb31a9937 | MATLAB | 4,789 | 138 | function IN = nk_CreateData4MLInterpreter(MLI, RandFeats, Tr, Ts, covars, IN, nx, curclass)
if IN.oocvflag
Yocvstr = 'Yocv2';
else
Yocvstr = 'Yocv';
end
method = MLI.method;
nperms = MLI.nperms;
if ~isempty(covars) && nx == 1
switch method
case 'posneg'
IN.covars_rep{1} = repmat(covar... |
62d12e7f7433921f55a17c9e987ce34683195fccda07cdadccc11df9759130f6 | MATLAB | 4,808 | 198 | function afterimagetest()
useEyeLink = false;
useStaircase = false;
backgroundColour = [0.5 0.5 0.5];
subject = 'Ian';
fixx = 0;
fixy = 0;
pixelsPerCm = 44; %32=Lab CRT -- 44=27"monitor or Macbook Pro
nBlocks = 10; %number of repeated blocks?
windowed = [800 800];
if useStaircase; type = 'STAIR'; else type = 'MOC'; e... |
7cf3f8fed83181666dd027567b682a0f7cb7d8df3ba5b2c765fbaf2d16e32072 | MATLAB | 4,824 | 130 | function [sY, IN] = nk_PerfRemMeanDiffObj( Y, IN )
% =========================================================================
% FORMAT [sY, IN] = nk_PerfRemMeanDiffObj( Y, IN )
% =========================================================================
% Normalizes given data (specified ind dIND) to global mean of giv... |
f4b97b1fe064291f4b63c7033cecaede41e9046052cd78e2c253b8a8b8b19a0f | MATLAB | 4,824 | 133 | %% ================================================================
% Script: FOCA_vs_FC_individual_dissimilarity.m
% Purpose:
% Evaluate whether FOCA provides individual-specific information
% beyond conventional FC by comparing subject-level dissimilarity
% (1 - Pearson’s r) between group- and individual-l... |
260584d080eebd141bf392bc3147d6950a84c111a28af2f05176c5169c9ae74c | MATLAB | 4,826 | 144 | function [wavePCData, wavePCNames, wavePCPar] = feature_WavePC1(V, ttChannelValidity, Params)
% MClust
% [wavePCData, wavePCNames, wavePCPar] = feature_wavePC1(V, ttChannelValidity, Params)
% Calculate first waveform PRINCIPAL COMPONENTS (PC1)
% if called with 2 arguments it recalcs the PC parameters,
% if called wit... |
5c0e4fc4205ab1a8be114d3a730a550c719c33616836afd63c52a01465a00cdf | MATLAB | 4,826 | 164 | classdef DisplayableCluster < MClust.ClusterTypes.Cluster
% DisplayableCluster (abstract)
properties(SetObservable)
% for display
hide = false;
color = [0 0 0];
markerSize = 1;
marker = '.';
hideButton;
colorButton;
end
pr... |
235278de0d086d550edeb54b66f313270d533dbdedd9982b7cdd534df8efaeff | MATLAB | 4,830 | 119 |
clear;
clc;
save_path = 'D:\930_paper_plotting\fig\rebuttal\fig_3_longitudinal_drift_trace';
if ~exist(save_path, 'dir')
mkdir(save_path);
fprintf('已创建保存路径: %s\n', save_path);
else
fprintf('保存路径已存在: %s\n', save_path);
end
savename_pdf = 'spike_position_drift_distribution_VS_depth_20250220_NoNorma... |
0b6b39f2f9f5b92912e8ad92c30aa0697d62d55d4c9bf44f32e45cc67a3e45fe | MATLAB | 4,837 | 126 | function param = nk_Gflip_config(param, setupfl, defaultsfl, ngroups)
% function param = nk_Gflip_config(param, setupfl)
%
% Setup parameters for G-flip algorithm
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% (c) N. Koutsouleris 4/2015
% Defaults
max_iter = 5;
block_size = 1;
st_points ... |
f5e7d9d4b0fcc277e1861eade7d4ef9a8d8c07f60905eb7053806282f47118c6 | MATLAB | 4,837 | 122 | function [Param, PX] = nk_ConstructW_config(Param, defaultsfl, parentstr)
if ~exist('defaultsfl','var') || isempty(defaultsfl), defaultsfl=0; end
Metric = 'Cosine';
NeighborMode = 'KNN';
WeightMode = 'Binary';
bNormalized = 0;
bLDA = 0;
K = 5;
T = 1;
PX = [];
if ~defaultsfl
if isempty(Param)
Param.M... |
3de52450edbe171158cdba62b2a4ee54f75160ebd8eb85955ca526ef3a499581 | MATLAB | 4,845 | 135 | function SA_feature_selection(Y, label, Ynew, labelnew)
% #####################################################################
% This code does:
% 1) Feature selection using SA
% 2) This is a simple code working on 1 single shot only. That is, this
% code work with a set of trainin, cross-validation and test set.
% ... |
bacc533db19b076fad9f72fc4d6212e79958fc3701a0d70498d4639fecc60726 | MATLAB | 4,857 | 187 | classdef feather < handle
% A feather is a container for a sequence of fit data
% It contains an array of fit data and an array of plot data
% corresponding to the outputs of bt.core.fit_spectrum()
% It also contains a copy of the model used for the fit
properties
fit_data
plot_data
time
path_prefix = ''... |
284ac7795bd5139364c20594286deac24cd6d5b0adb676ca5e7b0f50d1daf696 | MATLAB | 4,869 | 162 | function [opt_hE, opt_E, opt_F, opt_Fcat, opt_D] = nk_MultiEntropMax(E, L, EnsStrat, C, G)
global BATCH
ind0 = L~=0;
E = E(ind0,:);
L = L(ind0);
nclass = max(C);
if EnsStrat.Metric == 2, T = sign(E); else T = E; end
% Compute initial ensemble performance
opt_hE = nk_MultiEnsPerf(E, T, L, C, G);
... |
95b4bb1fbda28617885553f0258a0c570c3f85186c42c6825ea68e6c2a547d53 | MATLAB | 4,873 | 166 | clear; clc;
load('...\LFPdata_Fig4D.mat')
figure()
set(gcf,'position',[-770 446 730 455]);
fs=LFP.fs;
t_start=-0.34;
t_end=0.3;
window=40; % time in ms
step=20; % time in ms
windowSize = round(window/1000*fs); % windows width
stepSize = round(step/1000*fs); % advancing step for sliding window
% Color... |
969b299a8b467f731f2eee198117262aec732ab6e0e7317877f83a298b873b4f | MATLAB | 4,890 | 166 | function [eigvector, eigvalue, sampleMean, elapse] = LPP(W, options, data)
% LPP: Locality Preserving Projections
%
% [eigvector, eigvalue] = LPP(W, options, data)
%
% Input:
% data - Data matrix. Each row vector of fea is a data point.
% W - Affinity matrix. Y... |
171ecc3cf08e5159e355ebe7203e373da413b33300a31b0a872cfcf56db9cb38 | MATLAB | 4,893 | 172 | function [tf,pow2,im] = spectr_fig(pow,f,sr,upF,downF,epoch_win, baseline_win, sec2cut,cLims)
%SPECTR_FIG Spectrogram basic plot
% [tf,pow2,im] = spectr_fig(pow,f,sr,upF,downF,epoch_win, baseline_win, sec2cut,cLims)
% Plots a time-frequency spectrogram.
%
% Required inputs:
% POW time-f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.