This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# gvaroquaux (adapted from tdh.net gmail com) | |
# 31.August.2011 | |
# try clustering module in scikits.learn | |
import numpy as np | |
from scipy import linalg | |
from sklearn.metrics.pairwise import euclidean_distances | |
from sklearn.cluster import SpectralClustering |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def _compute_bins(x, n_bins=10): | |
""" Find optimal bins from a univariate distribution | |
Parameters | |
=========== | |
x: 1D array-like | |
Samples | |
n_bins: integer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""A helper node to concatenate images in nipype""" | |
import os | |
from nipype.interfaces.base import TraitedSpec, File, CommandLineInputSpec, CommandLine | |
from nipype.utils.misc import isdefined | |
class ConcatImgInputSpec(CommandLineInputSpec): | |
in_file1 = File(exists=True, argstr="-append %s", | |
position=1, mandatory=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import sys | |
import numpy as np | |
from numpy.lib.stride_tricks import as_strided | |
from math import sqrt | |
from scipy import linalg | |
from scikits.learn.linear_model import Lasso, lars_path | |
from joblib import Parallel, delayed |
NewerOlder