sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
30a4a245f977e1ebc1c36c340842120d8606ae8a46235509c66b4b8d8f6c20f9 | MATLAB | 2,212 | 71 | function saveDATasMER(datadir)
%SAVEDATASMER converts inomed '*.dat' file to '*.mat' file
% SAVEDATASMER(datadir) reads the manually chosen '*.dat' file from directory DATADIR, plots the
% recorded signal and converts it to a '*.mat' file.
% Lendulet Laboratory of Systems Neuroscience
% Institute of Experimental... |
7b9509bf3a2359ec4618c6a017c8da652cc0da357e2abe37e9c0070230d4b61c | MATLAB | 2,212 | 66 | function [adfreq, n, ts, fn, ad] = plx_ad(filename, channel)
% plx_ad(filename, channel): read all a/d data for the specified channel from a .plx or .pl2 file
% returns raw a/d values
%
% [adfreq, n, ts, fn, ad] = plx_ad(filename, channel)
% [adfreq, n, ts, fn, ad] = plx_ad(filename, 0)
% [adfreq, n, ts, f... |
92a0bb398db206d24f87a3979d4b57c3c7718d2d8e4c74673251bf5179e490d4 | MATLAB | 2,215 | 68 | %% file example_iMSF.m
% a toy example on using the iMSF method for learning from block-wise
% missing data using Logistic_iMSF.m function
%
%% OBJECTIVE
% see manual
%
%% LICENSE
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as ... |
6bf5d1d2d13ef3cbfe4883b65e87e1c625e6eb9e9b7412d2b4aedb31529d78d5 | MATLAB | 2,219 | 73 | function [sY, IN, Yrecon] = nk_PerfDevMapObj(Y, IN)
switch IN.DEVMAP.algostr
case {'pls','spls'}
devfun = @PerfPLSObj; params = IN.DEVMAP;
end
if isfield(params,'mpp') % Apply model to data
if iscell(Y)
sY = cell(1,numel(Y)); Yrecon = sY;
for i=1:numel(Y)
% Define active i... |
64ad739f42c69eb00895c75863579f0d393f3a5f07af8e61f403d77733c25ab7 | MATLAB | 2,222 | 59 | %% step1 确认保存位置
%change while needed
clear;
clc;
%
savepath = 'D:\930_paper_plotting\fig\fig_3_256_stability'; % Create saving path
if ~exist(savepath, 'dir')
mkdir(savepath);
end
%% 手动load数据
% includeHS
subject = {'P1', 'P2', 'P3', 'P4', 'P5', 'P6', 'P7', 'P8','P9','P10','P11'};
single_unit_count = [... |
19633aa6c58aca289f6cfd20dc8aaedaf5afb630fd1ee938039587700cdfef7c | MATLAB | 2,223 | 42 | function [events,epochs] = defineEventsEpochs_pdtask
%DEFINEEVENTSEPOCHS_PDTASK Define events and epochs for spike extraction.
% [EVENTS,EPOCHS] = DEFINEEVENTSEPOCHS_PDTASK defines events and epochs
% for spike extraction.
%
% EVENTS is a Nx4 cell array with columns corresponding to EventLabel,
% Event... |
6d76cbc50f1649f1694b3ba08489c3673ec97cc664bfe4a6d7eb02151fb528f4 | MATLAB | 2,226 | 73 | function d = L2_distance(a, b)
% L2_DISTANCE - computes Euclidean distance matrix
%
% E = L2_distance(A,B)
%
% A - (DxM) matrix
% B - (DxN) matrix
%
% Returns:
% E - (MxN) Euclidean distances between vectors in A and B
%
%
% Description :
% This fully vectorized (VERY FAST!) m-file computes the
% Euc... |
d73c5de9baeccd6b30abc76e843b03c0cb54c054d7f9ce2fb998b6600e415909 | MATLAB | 2,233 | 55 | function [idx_feat, weights, score] = gflip_gpu(X_train, Y_train, extra_param)
% [idx_feat, score] = gflip(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_param is a struct that may contain... |
9b19a13e394e48b7d9da486c861ff431521bbe81e2ef8c49c463299ce90eb3e6 | MATLAB | 2,241 | 63 | function addOptickaToPath(addPTB)
% adds opticka to path, ignoring unneeded folders. Also ensures other
% related code folders are present.
% in general we do not want to add PTB paths as this is done by
% SetupPsychToolbox, but for CI tasks it may be necessary to at least have
% PTB functions available even when not ... |
a4e86ed1c698efb476aab7381b0a8d9a30c93a2958ae592fdb692acdc391f111 | MATLAB | 2,241 | 58 | function coeffs = calc_eigendecomposition(data, eigenvectors, method, params)
% calc_eigendecomposition.m
%
% Decompose data using eigenvectors and calculate the coefficient of
% contribution of each vector
%
% Inputs: data : data [MxP]
% M = number of points, P = number of independent d... |
f61d061d5d5a34ab0ca7bd14797e45d9307f3c90405d33bc7e325351988754fa | MATLAB | 2,244 | 60 | function runConcatStep3to4(path)
%% Pipeline for the proper concatenation of miniscope data across sessions
% Developed by Daniel Almeida Filho Mar/2020 (SilvaLab - UCLA)
% If you have any questions, please send an email to
% almeidafilhodg@ucla.edu
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
b4020413ef8c0efcc2753022499372a799c9a6598d7440300cfe2e88a83a5acb | MATLAB | 2,245 | 81 | function o = nifti1struc
% Create a data structure describing NIFTI-1 headers
%__________________________________________________________________________
% Copyright (C) 2005-2017 Wellcome Trust Centre for Neuroimaging
%
% $Id: nifti1struc.m 7147 2017-08-03 14:07:01Z spm $
persistent org;
if ~isempty(org)
o = or... |
524caf63037e41e1f38baed9770659304847c2896e98cb2cf43c5a7263a66a31 | MATLAB | 2,248 | 70 | function [K, runtime, Phi] = spkernel(Graphs, features)
% Compute the labeled shortest path kernel for a set of node-labeled graphs
% Copyright 2012 Nino Shervashidze
% Input: Graphs - a 1xN array of graphs
% features - a boolean: 1 if we want to output the feature
% vector representation for e... |
2d4eec934fc889dfef526f947fa20e586d44408c89de6b6bf029ad3fff3d749e | MATLAB | 2,250 | 68 | function [EBC,BC]=edge_betweenness_bin(G)
%EDGE_BETWEENNESS_BIN Edge betweenness centrality
%
% EBC = edge_betweenness_bin(A);
% [EBC BC] = edge_betweenness_bin(A);
%
% Edge betweenness centrality is the fraction of all shortest paths in
% the network that contain a given edge. Edges with high values of
% ... |
ea1b44eda5ff9920bc036974734b2d36ed5378d27abcc57e5932c297fb0d074b | MATLAB | 2,253 | 81 | function [N, F, K, Vo, V, Ro, class_label] = load_dataset(dataset, rho)
switch dataset
case 'PIE'
data = importdata('../data/PIE/PIE_pose27.mat');
Vo_org = data.fea;
class_label_org = data.gnd;
Vo_org = Vo_org';
%N = size(Vo_org, 2);... |
1a3b3cc4ae3eadb51210c40d3ef9ae591a092d7ca2971b90e80e844bb9a7e5f1 | MATLAB | 2,259 | 71 | function [tmcd,smcd,weights,initmean,initcov,res,raww,Hopt]=unimcd(y,h)
%UNIMCD computes the MCD estimator of a univariate data set. This
% estimator is given by the subset of h observations with smallest variance.
% The MCD location estimate is then the mean of those h points,
% and the MCD scale estimate is their... |
b5512b433d4506cda8ba776713d4ce537f42630d6d53566a42ac25b47522bab3 | MATLAB | 2,260 | 62 | function [surface, V, D, M, S] = calc_geometric_eigenmode(surface, k, sigma, lump, standardize)
% calc_geometric_eigenmode.m
%
% Calculate the eigenvectors (eigenmodes) and eigenvalues of the input
% surface/volume
%
%
% Inputs: surface : surface structure with fields
% 'vertices' - vertex lo... |
dca1fc87d19a56ad812c54dd7334d204c62df7c0e4a9dcfd23317afd08e7932b | MATLAB | 2,260 | 76 | function inv = norminv (x, m, s)
% NORMINV Quantile function of the normal distribution
% INV = norminv(X, M, S) computes the quantile (the inverse
% of the CDF) at X of the normal distribution with mean M
% and standard deviation S.
%
% INV = norminv(X) is equivalent to INV = norminv(X, 0, 1)
% Adapted f... |
7d8aa2e874433a30d568a6fd30836ebd6c16d08714d169247e3218ed949ee453 | MATLAB | 2,269 | 67 | function [mappedX, mapping] = pca(X, no_dims)
%PCA Perform the PCA algorithm
%
% [mappedX, mapping] = pca(X, no_dims)
%
% The function runs PCA on a set of datapoints X. The variable
% no_dims sets the number of dimensions of the feature points in the
% embedded feature space (no_dims >= 1, default = 2).
% For no_d... |
ada75c3d7e4398fe062e3db4428bfbc430f901d16abbd10288cca94796787cc1 | MATLAB | 2,269 | 68 | % Objective function for extended NDM (eNDM)
%
% param(1) = x0_value
% param(2) = beta1 = diffusivity parameter
% param(3) = alpha1 = linear growth/clearance term in x
% param(4) = alpha2 = cell-type reweighting for alpha1
% param(5) = beta2 = cell-type reweighting for beta1
function [f] = objfun_eNDM_costopts(para... |
5cfc9e1b2dcf49dc4cf05377fdc97d06c1b7d1259acc36c865c73fcc59a9e70a | MATLAB | 2,270 | 61 | %% script to compute small-world-ness and do statistical testing on example data network
% Mark Humphries 3/2/2017
clear all; close all;
% analysis parameters
Num_ER_repeats = 100; % to estimate C and L numerically for E-R random graph
Num_S_repeats = 1000; % to get P-value for S; min P = 0.001 for 1000 samples
I = ... |
9f4a91f79f9c0be509eefe369712cac49fb0c67066aad23f95744efc6850cf5d | MATLAB | 2,273 | 87 | function sts = write_hdr_raw(fname,hdr,be)
% Write a NIFTI-1 header
% FORMAT sts = write_hdr_raw(fname,hdr,be)
% fname - filename of image
% hdr - a structure containing hdr info
% be - whether big-endian or not [Default: native]
%
% sts - status (1=good, 0=bad)
%_____________________________... |
783e65f390172522afb120f448e98b0b9cda27f9b57bd1cd2e3253a4860c5a20 | MATLAB | 2,277 | 69 | function autocorr_PD(cellids,fr_names,freq_bands,win)
%AUTOCORR_PD Auto-correlation
% AUTOCORR_PD(cellids,fr_names,freq_bands,win) calculates and plots auto-correlations
% at 0.5 ms resolution for a given window size (WIN) for CELLIDS units.
% Calculates burst index and oscillation indeces (for detail... |
c916c793497f77ac11d43f0a81ff6928568a173178d577fe95a0741e5b69f419 | MATLAB | 2,277 | 79 | function IO = ReadNifti(IO)
% Scale images
if isfield(IO,'globscale') && IO.globscale>1
g = IO.g;
GM = IO.globnorm;
else
g = ones(size(IO.PP,1),1); GM = 1;
fprintf('\nNo global normalization.')
end
gSF = GM./g;
V = IO.V;
cnt = 1; nV = numel(V);
for j = 1 : nV
for i = 1:numel(V{j})
V{j}(... |
267c1d8cfc3dbb6685a3a1fba41c289dced1ebb0665c6502bffae6c20d1e0e0b | MATLAB | 2,280 | 79 | function [id, rect, shader] = CreateProceduralPolarBoard(windowPtr, width, height, ...
color1, color2, radius, type)
% [id, rect, shader] = CreateProceduralPolarBoard(windowPtr, width,
% height [, color1=[1 0 0]] [, color2=[0 1 0]] [, radius=0])
%
% A procedural checkerboard shader that can generate either sinusoidal... |
81449ed30b05550e6ee3791b7176ae053ca93c30989b7b355166ced80177dadf | MATLAB | 2,286 | 62 | function nk_MLOptimizer_batch(paramfile)
global NM
% Read parameter file
% ===========================
if ~exist(paramfile,'file')
error([paramfile 'not found. Abort job!']);
end
fid = fopen(paramfile);
params = textscan(fid, '%s');
fclose(fid);
% Parse parameters in params
% ===================================... |
c149cf9b82909d74a92d242ce86158419ffb351d592110f3ed3b768337a4acfc | MATLAB | 2,286 | 52 | function [ sY, Y, IN ] = nk_CorrectPredTails( Y, X, IN )
% =========================================================================
% function [ sY, Y, IN ] = nk_CorrectPredTails( Y, X, IN )
% =========================================================================
% Regression models usually produce higher predictio... |
534e99e3337412546b0f4b448e0bc3f517ea0ce2247a4d1af661e1a3548238b4 | MATLAB | 2,288 | 59 | classdef reduced_ln < bt.model.reduced
% This model is set up to fit t0 keeping the prior fixed if the alpha peak is not present
% Note that prepare_for_fit must be used before spectrum() can be used
% Uniform priors and DB initial fit
% Note that this does sum over k
properties
end
methods
function self = re... |
bca92ca0905d37a977bf791b538a85218d7635bf328897381e0739b15de3e764 | MATLAB | 2,292 | 113 | % SBL_KERNELFUNCTION Compute kernel functions for the RVM model
%
% K = SBL_KERNELFUNCTION(X1,X2,KERNEL,LSCAL)
%
% K N1 x N2 (or N2+1 if bias ) design matrix.
% The first column comprises 1's if a bias is used
%
% X1 N1 x d data matrix
% X2 N2 x d data matrix
% KERNEL Kernel type: currently one of
% 'gauss' G... |
762b21655d198582149f82477526ba2bbe271978dab1a929f038ea27cbf7b794 | MATLAB | 2,297 | 64 | function [] = calculateComponentWeightedAverageNIFTI(dataList,resultsDir,numBases)
% dataList: .csv file containing the images for which the coefficients need
% to be calculated. Full path for every image file is given in
% every line
% resultsDir: directory where the NMF results are (i.e., the lev... |
944c8f99589ccb59a057f7729cca5e5265bbe3990d7735fb29021669ffb36761 | MATLAB | 2,299 | 89 | % demonstration file for NMFLibrary.
%
% This file illustrates how to use this library.
%
% This file is part of NMFLibrary.
%
% Created by H.Kasai on July 23, 2017
% Modified by H.Kasai on May 16, 2019
clc;
clear;
close all;
rng('default')
%% generate synthetic data of (mxn) matrix
m = 200;
n = 200;
V = ran... |
a55d4299a8cdb0d944a7ff1db36627297f7d00026e8a713da3cbaa8a33f215b7 | MATLAB | 2,300 | 57 | function nk_Preprocess_batch(paramfile)
global BATCH NM
% Read parameter file
% ===========================
if ~exist(paramfile,'file')
error([paramfile 'not found. Abort job!']);
end
fid = fopen(paramfile);
params = textscan(fid, '%s');
fclose(fid);
% Parse parameters in params
% ==============================... |
b8f5d53a6b6fa70f149173a6ae8e9b2cf8c61282636c2f8d29c230f7b6563a99 | MATLAB | 2,304 | 72 | function mapping = mcml(X, labels, no_dims)
%MCML Performs MCML on the specified dataset
%
% mapping = mcml(X, labels, no_dims)
%
% Performs linear Maximally Collapsing Metric Learning (MCML) on the
% dataset specified through X and labels. The function returns a
% Mahalanobis metrix in M. Distances through the met... |
bcf6a118e281a4b92263e71c25ef4d78f002d9545a695b6f0e63f24db1a8112e | MATLAB | 2,305 | 67 | %% FUNCTION line_search_cond_RMTL
% line search condition of robust multi-task learning formulation.
%
%% INPUT
% L_hat, S_hat: the pair of solution points
% P, Q: the pair of searching points
%
%% LICENSE
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU G... |
1b12ac12e8136636925c7f9fdc3cbb471bc0181c7745cdc02ba765f0752c154e | MATLAB | 2,315 | 58 | function mappedX = run_llc(X, no_dims, k, no_analyzers, max_iterations, eig_impl)
%RUN_LLC Performs the LLC algorithm for dimensionality reduction
%
% mappedX = run_llc(X, no_dims, k, no_analyzers, max_iterations)
%
% Performs the Locally Linear Coordination (LLC) algorithm to reduce the
% dimensionality of dataset X... |
4844b7df8de2489bf2fbaa6a6f80ea88c96e1aecc69d3b77ff01b8a16c5ad3d8 | MATLAB | 2,316 | 88 |
%%
%cross validation for composite model: W=P+Q
%Han Cao
%24.02.2017
%%
function [ best_lambda1 best_lambda2 perform_mat] = CrossValidationDirty...
( X, Y, obj_func_str, obj_func_opts, lambda1_range, lambda2_range, cv_fold, eval_func_str)
eval_func = str2func(eval_func_str);
obj_func = str2func(obj_func_str)... |
76f7ea690e5899510f6833f68d016ad531e87f6874a0bbeecd6ece06234caef1 | MATLAB | 2,316 | 85 | function vol = read_hdr(fname)
% Get a variety of information from a NIFTI header
% FORMAT vol = read_hdr(fname)
% fname - filename of image
% vol - various bits of information
%__________________________________________________________________________
% Copyright (C) 2005-2017 Wellcome Trust Centre for Neu... |
9018fec7cc9a18d9fcf806c17ffc4738171a608b94d1ce08f251fa0f8fc3a75f | MATLAB | 2,321 | 73 | function [errorcode, varargout] = common_size (varargin)
% COMMON_SIZE Checks that all inputs are either scalar or of common size
% [ERR, Y1, ...] = common_size(X1, ...)
% Determine if all input arguments are either scalar or of common
% size. If so, ERR is zero, and YI is a matrix of the
% common size w... |
bb2e02c454112408f2145f91b5888a09538a68df81daba15067087a60f5a71fe | MATLAB | 2,328 | 71 | % function that evaluates the reconstruction error only on whole brain
clear
clc
% read the data
data_lst = '/cbica/home/chenyin/PD_Spatial_Project/Script/Atlas_CER_W/CER_W_All.csv';
fid=fopen(data_lst,'r');
datafullpath = textscan(fid,'%s %d\n');
fclose(fid);
datafullpath = datafullpath{1,1} ;
count = numel(datafu... |
f8449901fc0cba1d5897f31f41eb7058a9a102278f9a131200ae7c5bfbdafa5a | MATLAB | 2,330 | 89 | function result=L1median(x,tol);
%L1MEDIAN is an orthogonally equivariant location estimator,
% also known as the spatial median. It is defined as the point which
% minimizes the sum of the Euclidean distances to all observations in the
% data matrix x. It can resist 50% outliers.
%
% Reference (for the algorithm):
... |
0841ee0d9e13049edd74f5539e09502b6d1dd81b19ca133ee277520caac2b63f | MATLAB | 2,333 | 87 | function [T,WV] = LoadSEfromCSC(fn, R, U)
% Loading enginer for MClust-4.0
%
%
sizeofdouble = 8;
if nargin == 1
fp = fopen(fn);
nS = fread(fp, 1, 'int');
nSamp = fread(fp, 1, 'int');
T = nan(nS, 1);
WV = nan(nS, 1, nSamp);
for iS = 1:nS
T(iS) = fread(fp, 1, 'double');
... |
bbbfc2859526b441b89507091baeb0bf790ef42e797cb4637d9a71a69f315a50 | MATLAB | 2,336 | 71 | function pdf = gampdf (x, a, b)
% GAMPDF PDF of the Gamma distribution
% PDF = gampdf(X, A, B) computes, for each element of X, the
% probability distribution (PDF) at X of the Gamma distribution
% with parameters A and B (i.e. mean of the distribution is A*B
% and variance is A*B^2).
% Adapted for Matlab (R) fro... |
1aa95c1d815777930ee85d0af09fcaf940db9cfe11a3cec06c452728a95b6dec | MATLAB | 2,339 | 64 | classdef reduced_ly_no_n < bt.model.reduced_ly
% This model is set up to fit t0 keeping the prior fixed if the alpha peak is not present
% Note that prepare_for_fit must be used before spectrum() can be used
% Uniform priors and DB initial fit
% Note that this does sum over k
properties
end
methods
function... |
12fd237ce03a8f8560ff2ba403a4524182fc604b5e5a56aa5d005c36e85f85d4 | MATLAB | 2,343 | 70 | function [mappedX, mapping] = nca(X, labels, no_dims, lambda)
%NCA Performs NCA on the specified dataset
%
% [mappedX, mapping] = nca(X, labels, no_dims, lambda)
%
% Performs linear Neighborhood Components Analysis (NCA) on the
% dataset specified through X and labels to reduce the data dimensionality
% to no_dims ... |
225462a632b836274b16b14a205010230de92327ef7ebb884fcf319d5c2196aa | MATLAB | 2,345 | 65 | function [xV, AnalP] = nk_GetAlgoWeightVec(SVM, Y, L, MD, decompfl, errorflag)
global STACKING
AnalP = []; xV=[];
switch SVM.prog
case {'LIBSVM','LIBLIN'}
switch SVM.kernel.kernstr
case{' -t 0',' -t 4',' -t 5','lin', 'linear', 'none'}
%%%%%%%%%%%%% USE WEIGHTS OF MODEL %%%%%%%%... |
22c1ef360298f6cb65f104e84cd522905004c109607914cbc6e0772a75681f09 | MATLAB | 2,345 | 62 | function [model, mappedX] = train_deep_autoenc(X, layers, lambda)
%TRAIN_DEEP_AUTOENC Trains a deep feedforward autoencoder on X
%
% [model, mappedX] = train_deep_autoenc(X, layers, lambda)
%
% The function trains a deep feedforward autoencoder on
% the specified X and labels. The variable X should be a Nx1 cell
% ar... |
c1a2f2665e5086b50e6712c6c7679a548935f3ff4830c9b90ce1173aa83887cc | MATLAB | 2,346 | 62 | function [featIndSelected,otherOutput]=featSel(trainSet,trainClass,fsMethod,option)
% feature selection
% trainSet, matrix, the training set with samples in columns and features in rows.
% trainClass: column vector of numbers or string, the class labels of the traning set.
% fsMethod: string, by now it can be 'none','t... |
082f9ebacd4717a5952eb8fce27b6cac577df9006570da514f5654f8e86f6377 | MATLAB | 2,348 | 80 | function [mappedX, mapping] = lda(X, labels, no_dims)
%LDA Perform the LDA algorithm
%
% [mappedX, mapping] = lda(X, labels, no_dims)
%
% The function runs LDA on a set of datapoints X. The variable
% no_dims sets the number of dimensions of the feature points in the
% embedded feature space (no_dims >= 1, default =... |
5974aed85c4e4b176ad0aba5c12057e737c049e7234a10f866f58b44c66d29ef | MATLAB | 2,348 | 70 | function TestMe(No_RandomFeature)
%Conduct experiment on the well-known spiral data
%---------------------------------------------------------------|
%Input:
% No_RandomFeature: number of randomly distributed features
%---------------------------------------------------------------
close all
... |
6fe7596ff43e37baf0e3405198e2fe29323e77b841274705d7a3a7d5208375b2 | MATLAB | 2,350 | 73 | %% SCRIPT test_script.m
% Multi-task learning training/testing example. This example illustrates
% how to perform split data into training part and testing part, and how
% to use training data to build prediction model (via cross validation).
%
%% LICENSE
% This program is free software: you can redistribut... |
31aec1d87d4fd26674a281ec672daa1d85f010528c69b91b37839c9ca78b756b | MATLAB | 2,352 | 80 | function [fnBase, nFiles, nKKFeatures] = WriteKKwikFeatureFile(fnBase, features, varargin)
% [fnBase, nFiles] = WriteKKwikFeatureFile(fnBase, features, varargin)
%
% Parameters
% maxSpikesBeforeSplit; 0 means don't split
% spikes; [] means use all spikes
MCD = MClust.GetData();
% -------------------
% Parms
... |
834faf3183bd4e985e6a1e29e925e43257b9610d6d30b4a431fb58c1bdbe4231 | MATLAB | 2,363 | 73 | % This is an example of how to extract features using NMF
%%%%
% Copyright (C) <2012> <Yifeng Li>
%
% 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 3 of the License, or
% any la... |
ab2c36495944ac26ef658fbcb3c9508870d56f5e93a2761d856150464882479d | MATLAB | 2,366 | 46 | % This is an example of how to conduct Friedman test and plot CD diagram
% Copyright (C) <2012> <Yifeng Li>
%
% 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 3 of the License, o... |
aea314ac3b4aa4353e5eec9f3e28caf5d94c52883554bca47b9e626f179964b6 | MATLAB | 2,366 | 56 | function handles = load_selAnalysis(handles)
flg1 = 0; flg2=0; flg3 = 0;
if isfield(handles,'ExportPredictionsM')
delete(handles.ExportPredictionsM);
delete(handles.ExportPerformanceM);
end
for i=1:numel(handles.NM.analysis)
if handles.NM.analysis{i}.status
flg1 = flg1+1;
if isfield(hand... |
ffe725e1a2b324613b773809135ac6d510209b782a790f032ed8697ab4dbdc20 | MATLAB | 2,373 | 52 | function h = plot_raster(x,y,width,color,linew)
% Simple XY plot with the symbol '|' instead of '.' or 'o'.
%
% Syntax:
% h = plot_raster(x,y,width,color,linew)
%
% Where: 'x' and 'y' are data vectors
% 'width', 'color' and 'linew' are the width (standard=1),
% col... |
37dddb9f6ce59f4276d1b31869c353c9c34fda6ee60dcda4a89fcd563ad14c19 | MATLAB | 2,382 | 72 | %% file example_Lasso.m
% this file shows the usage of Least_Lasso.m function
% and study the sparsity patterns.
%
%% OBJECTIVE
% argmin_W { sum_i^t (0.5 * norm (Y{i} - X{i}' * W(:, i))^2)
% + rho1 * \|W\|_1 + opts.rho_L2 * \|W\|_F^2}
%
%% LICENSE
% This program is free software: you can redistribute it... |
bb64a0637738efed340c94600ad1264e96dba06044c7489fa795411ed1ebd21f | MATLAB | 2,386 | 72 | function [count] = countconnected4graphlets(A, L)
% Count all 4-node connected 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: A - nxn adjacency matrix
% L - 1xn cell array... |
e1df16ec766c7fff5ade15f73e8c713fd2d830cb112b875be355a80c95a085fb | MATLAB | 2,388 | 56 | % =========================================================================
% = ROC ANALYSIS =
% =========================================================================
function [ hroc, hroc_random] = display_roc(handles, targets, predictions, axeshdl, clafl, l... |
19e4706f736a660bf6061c30da03ccca20ab208ebe04a7640e1c14ff1903cb33 | MATLAB | 2,392 | 70 | % Load data
clear all
close all
for monkey=1:2
if monkey==1
monkey_name='Jupiter';
Mean_value_c = 0.517;
Mean_value_Ic = 0.664;
elseif monkey==2
monkey_name='Mercury';
Mean_value = (0.913+1.086)./2;
Mean_value_c = 0.913;
Mean_value_Ic = 1.... |
544bb98d557a9cdf5eda759197152954205084a7497d1750b301d69909276f6a | MATLAB | 2,394 | 97 | function ret = validation_function(dec, labels);
labels = (labels >= 0) - (labels < 0);
valid_function = @(dec, labels) auc(dec, labels);
ret = valid_function(dec, labels);
%precision(dec, labels);
%recall(dec, labels);
%fscore(dec, labels);
%bac(dec, labels);
%auc(dec, labels);
%accuracy(dec, labels);
function ret = ... |
48f646f5d9f47c6ae2233ef56fdbe5855dda42e082874971937a8dbfaeeaef82 | MATLAB | 2,395 | 67 | function Evinxx = save_evinxx(EEG_ep,EventTypes,SubEventTypes,curr_resdir,issave)
%SAVE_EVINXX Saves good trial indeces
% Evinxx = SAVE_EVINXX(EEG_ep,EventTypes,SubEventTypes,curr_resdir,issave)
% creates struct with fields corresponding to events (EVENTTYPES) and
% subevents (SUBEVENTTYPES). The ... |
5c3b74a925bd0dd9300e1888e26e0a4281da010cc365ff1d9ac0a293574196a1 | MATLAB | 2,396 | 73 | function [w_Brain, model_All] = W_Calculate_SVR(Subjects_Data, Subjects_Scores, Pre_Method, C_Parameter, ResultantFolder)
%
% Subject_Data:
% m*n matrix
% m is the number of subjects
% n is the number of features
%
% Subject_Scores:
% the continuous variable to be predicted,[1*m]... |
95e95d2f5a2228f567b941ccb654368c5276781cd3d0c0c869105f8e3cde1b61 | MATLAB | 2,397 | 80 | function [R,eff]=randmio_und(R, ITER)
%RANDMIO_UND Random graph with preserved degree distribution
%
% R = randmio_und(W,ITER);
% [R eff]=randmio_und(W, ITER);
%
% This function randomizes an undirected network, while preserving the
% degree distribution. The function does not preserve the strength
% dist... |
bbd2cbaf26067f36c0112da6237f171cb0553b6ba59fb9ee95df0420fe047a15 | MATLAB | 2,397 | 102 | classdef Cluster < handle & matlab.mixin.Copyable
% Cluster (abstract)
%
% Basic cluster minimal operations
%
% Clusters that include display options should subclass from
% DisplayableCluster.
properties(Constant)
ClusterFuncKey = 'ClusterFunc_';
end
properties(Access=public)
name = 'Cluster'; % name
... |
bbc1c693abde1a6306e9962204801f0c88ce006e72b662d43f0466c3995c291d | MATLAB | 2,401 | 66 | function [adjT, IN] = nk_AdjForCovarsUsingPCA(T, IN, S, CS, corrthresh)
% =========================================================================
% function [adjT, Param] = nk_AdjForCovarsUsingPCA(T, IN, S, CS, corrthresh)
% -------------------------------------------------------------------------
% Inputs:
% S : ... |
d528676d7008810b2fe6c0e4c9796abc75e2dd0ab02202f30c83bd29976c6b6a | MATLAB | 2,402 | 74 | function gui_sc (action)
%
% This file is used by FASTICAG
% This file holds the callbacks for save-dialog
% @(#)$Id: gui_sc.m,v 1.3 2003/09/08 11:28:59 jarmo Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Global variables
% Handle to the window
global hf_FastICA_Save;
% H... |
da911e226f2c0c6fd11344224390adc0a336b1e9a35f05996e48befee887e832 | MATLAB | 2,404 | 66 | %Biases = rand(20,2*3*2); % subjects, Hemi*Mask*Fam
load('N250_left.mat') % left
A = erpval;
load('N250_right.mat') % right
B = erpval;
erpval = horzcat(A,B);
[n,c2] = size(erpval);
varNames = cell(2*3*2,1);
for i = 1 : 2*3*2
v = strcat('V',num2str(i));
varNames{i,1} = v;
end
% Create a table storing th... |
3ec42b2b1cf280ec6c2d73cf45105ec3421766147d7590d0a668fe087e93e72c | MATLAB | 2,411 | 60 | %% FUNCTION Least_iMSF
% Incompletet Multi-Source Learning with Least Squares Loss (interface). This
% code generates structural information for MultiSource_LeastR and
% performs the optimization.
%
%% OBJECTIVE
% see manual.
%
%% INPUT
% A_Set: {n * d} * t - input. The cell array of data. Each cell should ... |
82ec7d743d51226994bec5d68929f17481daddce3cad1b21566eb47f2d906eba | MATLAB | 2,416 | 102 | function [W, info] = MTFLCd_ADMM_WSolver...
(Xdiag, yvect, Thvect, Zvect, rho, lambda1, lambda2, opts)
%
% Multi-Task Feature Learning with Calibration - ADMM
% Subproblem: W
% diagnoalized version.
%
% Objective
% min_W { rho/2 sum_i^m ||theta_i/rho - z_i + y+i - X_iwi||
% + lambda2/2 ||W||_F^2 +... |
0d31e6ec1d6d7ceb08782918d85b56b5411494334ec9063b9e2f01c34baeb959 | MATLAB | 2,418 | 66 | function [Vmean, V] = nk_VisSV(model, X, Y)
%
% function [Vmean, V] = nk_VisSV(model, X, Y)
%
% Computes the minimum difference vector matrix V for a given SVM model
% (currently only LIBSVM) by finding the minimum difference vector for each SV
% of class +1 to the SVs of class -1.
%
% INPUTS
% * model: LIBS... |
dade3bf41ee977e58a943305ff33df596d973578ca22221e9008c16bc954cf88 | MATLAB | 2,418 | 88 | classdef touchData < optickaCore
properties
subject
data
verbose = true
end
properties (GetAccess = public, SetAccess = protected)
nData
nSessions
end
properties (Access = protected)
dataTemplate = struct('date',[],'startTime',NaN,'comment',[],'phase',[],'time',[],...
'trials',[],'result',[],'rt'... |
4e1a5edc47ef7cd7d6f0459b47933af682701233cf5d7b59e290d0276f34a25b | MATLAB | 2,421 | 60 | %% FUNCTION Logistic_iMSF
% Incompletet Multi-Source Learning with Logistic Loss (interface). This
% code generates structural information for MultiSource_LogisticR and
% performs the optimization.
%
%% OBJECTIVE
% see manual.
%
%% INPUT
% A_Set: {n * d} * t - input. The cell array of data. Each cell should... |
8eeba131b019e693c201b559f6528f44e047dab2d6a2ca08d7279aea561a425e | MATLAB | 2,421 | 76 | function ellipsplot(center,covar,data,dist,nid,labx,laby)
%ELLIPSPLOT plots the 97.5% tolerance ellipse of the bivariate data set
% (data). The ellipse is defined by those data points whose distance (dist)
% is equal to the squareroot of the 97.5% chisquare quantile with 2 degrees of
% freedom.
%
% Required input ... |
81e19895118ffea8460ab80f4885dac180c490ef6b529b148ab7ca7bb8911cb9 | MATLAB | 2,427 | 66 | function miY = nk_MI(Y, dat, SplitFlag)
[ix,jx] = size(dat.cv.TrainInd);
miY{ix,jx} = [];
MItype = dat.TrainParam.MI.type;
for i=1:ix
for j=1:jx
fprintf('\nScaling outer CV folds [%g,%g].',i,j)
switch SplitFlag
% Dimred. is performed on ALL data for each outer CV loop
... |
bcacd05f720874c54317e992e1f4a7b1b72695d3bb37c92221ebefc3377ef9a9 | MATLAB | 2,429 | 87 | %% FUNCTION example_LSSMTC.m
% Example of multi-task clustering.
%
%% LICENSE
% 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 3 of the License, or
% (at your option) an... |
7ccf7f8c32988a517fd13a4aa552d27930194694dad5a6ea55d67e1e92e317f2 | MATLAB | 2,430 | 52 | function openephys_SaveMClustFeatures(TT_file_name,FeaturesToUse,ChannelValidity,TT_path_name)
%OPENEPHYS_SAVEMCLUSTFEATURES Save feature files for MClust import.
% OPENEPHYS_SAVEMCLUSTFEATURES(TT,FEATURESTOUSE,CHANNELVALIDITY,TT_PATH)
% calculates and saves feature files for MClust plotting. Input
% argume... |
112fa3f7b252073b22868b35260afacf470eb6ff0a4f9c15ae4c77cde70490ec | MATLAB | 2,431 | 73 | function test_seminmf()
%
% demonstration file for NMFLibrary.
%
% This file illustrates how to use this library.
%
% This file is part of NMFLibrary.
%
% Created by H.Kasai on July 21, 2017
clc;
clear;
close all;
%% generate synthetic data of (mxn) matrix
m = 500;
n = 100;
V = ran... |
354e94b9e8d5fff96c1e31c84bee43864e5f9f1a92fb51076e728280d0117c49 | MATLAB | 2,433 | 81 | function [vtx,fac,extra] = palm_objread(filename)
% Read a surface file, in ASCII format.
%
% [vtx,fac,extra] = palm_objread(filename);
%
% - vtx contains the coordinates (x,y,z), one vertex per row
% - fac contains the indices for the three vertices of each face
% - extra contains additional elements from the obj fi... |
90ed99c8a13af4abdecd5e78a3e276028e77b941187396a37979a909b1aeef49 | MATLAB | 2,434 | 74 | function [indCluster,Xout,Aout,Yout,numIter,tElapsed,finalResidual]=NMFCluster(X,k,option)
% NMF based clustering
% Usage:
% [indCluster,Xout,Aout,Yout,numIter,tElapsed,finalResidual]=NMFCluster(X) % in this case, X is coefficient matrix obtained by a NMF outside this function
% [indCluster,Xout,Aout,Yout,numIter,tElap... |
f8dc540ad6a8282121db86e70fe95db9a0c360d38514a5f64a88f82adef5f190 | MATLAB | 2,438 | 95 | <<<<<<< HEAD
function M = ply_read(filename)
% Read PLY-formatted data from disk
% FORMAT M = ply_read(filename)
%
% filename - PLY-formatted file name
% M - data structure
%__________________________________________________________________________
%
% Stanford Triangle Format Specification:
% https://... |
42bc9dfe09b3562b71a516786bd22dbf5c647aa4a87dc6439cfeedcf944b74eb | MATLAB | 2,450 | 60 | function nk_Utilities
global CV NM
menustr = ['Set root paths of neuroimaging tools (SPM/Freesurfer)|' ...
'Create PreprocData path master|' ...
'Create CVdatamat path master|' ...
'Create CVresults path master|' ...
'Create VISdatamat path master|' ...
'Create Op... |
874231a4ce12d5c191eb3aab84431c453070eba1358e1537670d090f6854ea55 | MATLAB | 2,453 | 60 | function [sY, IN] = nk_PerfElimZeroObj(Y, IN)
% =========================================================================
% FORMAT function [sY, IN] = nk_PerfElimZeroObj(Y, IN)
% =========================================================================
% Remove features with zero-variance, and ANY Infs and NaNs.
% Furt... |
47457f71c7fbd8c13c07108980ee06138e2471271a0443c4a72918795bc15fd9 | MATLAB | 2,456 | 65 | % COPY_TIMING(mutants,cmd,...) copies template timing files into data directories
%
% Inputs
% REQUIRED
% 'mutants' struct of mutant directories with .exp fields
% 'cmd' struct that informs what timing files to copy where
% fields:
% 'mutant' maps to mutants(i).name
% 'exp' ... |
817a61e8baeadd170fb2c2ecda949a1f691a58f41b478a3493d12390f94de3df | MATLAB | 2,461 | 80 | function comp_nmf_base_algorithms()
%
% demonstration file for NMFLibrary.
%
% This file illustrates how to use this library.
%
% This file is part of NMFLibrary.
%
% Created by H.Kasai on OCt. 27, 2017
clc;
clear;
close all;
%% generate synthetic data of (mxn) matrix
m = 1000;
n = 100... |
285662d77e35104bad0e810c0e8f33b5876e83096f4cbd602e261ba9a210fe68 | MATLAB | 2,464 | 73 | function PC_cells_PSTH(event, fr_name, chanmean, rectype, dominantfreq,PC_win, ds, plot_win)
%PC_CELLS_PSTH PSTH of sign. phase-coupled units.
% PC_CELLS_PSTH(...) draws 2 types of figures:
% 1. Maps of the PSTHs of all sign phase-coupled units, sorted according to
% -the magnitude of firing rate change... |
0a3989744c65c54b2bc491fb366c2a5f7685ff5659a8b09b3864825b9b2abbab | MATLAB | 2,465 | 84 | function gcdf = palm_gcdf(G,df1,df2)
% Convert a pivotal statistic computed with 'pivotal.m'
% (or simplifications) to a parametric p-value.
% The output is 1-p, i.e. the CDF.
%
% Usage:
% cdf = palm_gcdf(G,df1,df2)
%
% Inputs:
% G : G or Z statistic.
% df1, df2 : Degrees of freedom (non infinite).
% ... |
1a21ef9af7f36fb6b672e7d7d4ef9f9bf265af7fd0ff36e228df8653369a0913 | MATLAB | 2,465 | 83 | function op = tfocs_prox( f, prox_f, VECTOR_SCALAR )
% OP = TFOCS_PROX( F, PROX_F )
% combines F and PROX_F into the appropriate TFOCS-compatible object.
%
% F is any function (with known proximity operator),
% and PROX_F is its proximity operator, defined as:
%
% PROX_F( Y, t ) = argmin_X F(X) + 1/(2*t)*|| X ... |
e576a815ef57d18e272f5106245d912eca8083e4d9e3b6fb35db0b24c3acf87f | MATLAB | 2,467 | 84 | function EEG_LFP_Wcoh_PD(EventTypes,side)
% EEG_LFP_WCOH_PD Mean-squared wavelet coherence (MSWC) map between intraop EEG and LFP
% EEG_LFP_WCOH_PD(EventTypes,SubEventTypes) draws an MSWC map
% patient-by-patient and averaged across patients around EVENTTYPES.
% Compares epochs partitioned based on SUBEVENTT... |
49c008e68257d34676b48679819e7d646287eb3d344828090976fc05cdf0052e | MATLAB | 2,468 | 83 | % handles all callbacks for TTImain
% there is usually no need to modify this
function TTIcallback(varargin)
% control handles
global hTTITank;
global hTTIBlock;
global hTTIEvent;
global hTTIListbox;
global hTTILabel;
% variables to hold current selections
global TTICurrentServer;
global TTICurrentTank;
global TTICur... |
ef4e6df007f5d187929edce8fb9632f5a56cd60a7e1ec360ebb689f1ff4c9c98 | MATLAB | 2,468 | 71 | function varargout = clinical_groups(varargin)
%CLINIAL_GROUPS sorts patients according to group labels
% patgroups = CLINIAL_GROUPS sorts patients according to clinical groups;
% patgroups = CLINIAL_GROUPS(groups_nm) sorts patients according to groups specified in GROUPS_NM;
% {patg... |
53542496f7c24c1036fc771fab8056601d38719fe6718136f0d72dad9f1d7755 | MATLAB | 2,482 | 61 | function [TransNodeMeanPerf, TransNodeSDPerf] = nk_ComputeTransNodePerformance(TransNodeArray, label, ix, jx, curclass)
global CV EVALFUNC MODEFL xCV simFlag
[PermNum, FoldNum] = size(TransNodeArray);
Perf = zeros(PermNum, FoldNum);
for Perm = 1 : PermNum
for Fold = 1 : FoldNum
if ~simFlag
... |
fa8519a0e97194dfb820178910ae540298281cdc4466acb237dd387e2814dcf5 | MATLAB | 2,482 | 78 | % Objective function for eNDM_general
%
% param(1) = seed rescale factor
% param(2) = alpha
% param(3) = beta
% param(4:(n_types+3)) = a
% param((n_types+4):(2*n_types+3)) = b
% param((2*n_types+4):(3*n_types+3)) = p
function [f,newxt,newpath] = objfun_eNDM_general_dir_costopts(param,seed_location,...
pathology,ts... |
abda53b3fd1b2bf25ee7742b9a9db3b6fb7cdd28fd82e2b000c201aa5f34159a | MATLAB | 2,488 | 79 | function [K,runtime] = l3graphletkernel(Graphs)
% Compute a 3-node connected labeled graphlet kernel on a set of graphs
% Author: Nino Shervashidze- nino.shervashidze@tuebingen.mpg.de
% Copyright 2012 Nino Shervashidze
%
% Input: Graphs - a 1xN array of graphs
% Output: K - NxN kernel matrix K
% runtime - scala... |
57107c7479c4e334bfea626506a0bf79752c0d7b70c7a443ed4f427ff674fb39 | MATLAB | 2,489 | 74 | %% file example_L21.m
% this file shows the usage of Least_L21.m function
% and study the group sparsity patterns.
%
%% OBJECTIVE
% argmin_W { sum_i^t (0.5 * norm (Y{i} - X{i}' * W(:, i))^2)
% + rho1 * \|W\|_{2,1} + opts.rho_L2 * \|W\|_F^2}
%
%% LICENSE
% This program is free software: you can redistrib... |
4451b975cd98f5b86894c07e69e0288ef2f81b38f10eec1ec7b69cf4666afdd0 | MATLAB | 2,490 | 104 | % SB1_KERNELFUNCTION Compute kernel functions for the RVM model
%
% K = SB1_KERNELFUNCTION(X1,X2,KERNEL,LENGTH)
%
% OUTPUT ARGUMENTS:
%
% K N1 x N2 kernel matrix.
%
% INPUT ARGUMENTS:
%
% X1 N1 x d data matrix
% X2 N2 x d data matrix
% KERNEL Kernel type: currently one... |
d924108ce1060eadc6db82c58e0e24e21275e13377ad4369fadd6665b03213a8 | MATLAB | 2,494 | 67 | function NM = nk_UpdateRootPaths(NM, AnalVec, NewRootDir)
if ~isfield(NM,'analysis')
fprintf('\nNo analyses found in NM structure')
return
end
if ~exist('NewRootDir','var') || isempty(NewRootDir) || ~exist(NewRootDir,'dir')
NewRootDir = nk_DirSelector('Update analyses'' root paths');
end
if ~exist('AnalVec... |
f576ba87a0334ebdfc22313514af59ca6c38e607e1a0fb7fce2525004defd2a5 | MATLAB | 2,494 | 78 | % This is an example of how to use NMF to find factor-specific genes and do gene set analysis.
%%%%
% Copyright (C) <2012> <Yifeng Li>
%
% 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 ... |
cfd575e3de6f4035c8c8ee517e11e6d0c1146af20e0ef2e0b6909aefa5b1465a | MATLAB | 2,496 | 74 | function [w_Brain, model_All] = W_Calculate_SVR_LOOCV(Subjects_Data, Subjects_Scores, Pre_Method, C_Parameter, ResultantFolder,fold)
%
% Subject_Data:
% m*n matrix
% m is the number of subjects
% n is the number of features
%
% Subject_Scores:
% the continuous variable to be pred... |
2bb521431bb23d32c082783b55d45bb107241aca6fd6719c3fe7f17c0d341f69 | MATLAB | 2,498 | 87 | function inv = nm_gaminv (x, a, b)
% GAMINV Quantile function of the Gamma distribution
% INV = gaminv(X, A, B) computes, for each component of X, the
% quantile (the inverse of the CDF) at X of the Gamma distribution
% with parameters A and B (i.e. mean of the distribution is A*B
% and variance is A*B^2).
... |
e1b9062672c97b510d1b7ff467d852a9c12ca38a218f46304d3354de093a6875 | MATLAB | 2,501 | 61 | function [F,pvalF,acceptF,rankCl,CD]=FriedmanTest(Error,alpha)
% Friedman test for comparing multiple classifiers over multiple data sets
% Error: matrix, Acc_ij is the error rate of classifier j over the ith data
% alpha: the significant level
% F: scalar, the value of F statistic
% pvalF: scalar, p-value
% acceptF: l... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.