This file contains hidden or 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
| # Author Michael Eickenberg <michael.eickenberg@nsup.org>, Fabian Pedregosa | |
| # Coded in 2012, another era, pure python, no guarantees for 1000% correctness or speed | |
| """ | |
| This module implements the Lowess function for nonparametric regression. | |
| Functions: | |
| lowess Fit a smooth nonparametric regression curve to a scatterplot. | |
| For more information, see |
This file contains hidden or 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
| # Disclaimer: This doesn't seem to work 100% yet, but almost ;) | |
| # Convolutional ZCA | |
| # When images are too large in amount of pixels to be able to determine the | |
| # principal components of an image batch, one can suppose translation | |
| # invariance of the eigen-structure and do the ZCA in a convolutional manner | |
| import theano | |
| import theano.tensor as T | |
| import numpy as np |
This file contains hidden or 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
| # Author: Michael Eickenberg | |
| # License: BSD 3-clause | |
| # This is a rapidly written proof of concept. There may remain big bugs. I find it overfits quite quickly atm | |
| import numpy as np | |
| import theano | |
| theano.config.floatX = 'float32' | |
| import theano.tensor as T | |
| from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams |
This file contains hidden or 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
| # Code for periodizing a signal in Fourier (corresponds to subsampling in signal space) | |
| def periodize_1d(array, axis, downsampling): | |
| axis_shape = array.shape[axis] | |
| before_shape = array.shape[:axis] | |
| after_shape = array.shape[axis + 1:] | |
| new_shape = before_shape + (downsampling, -1) + after_shape | |
| return array.reshape(new_shape).mean(axis) | |
This file contains hidden or 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
| """testing skcuda fft in 3 dimensions""" | |
| import pycuda.autoinit | |
| import pycuda.gpuarray as gpuarray | |
| import numpy as np | |
| #from scipy import fftpack as fft | |
| from pyfftw.interfaces import numpy_fft as fft | |
| import skcuda.fft as cu_fft |
This file contains hidden or 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
| def kcca_dual_coef(K1, K2, gamma, n_coefs=None, reduced_problem=False): | |
| eigen_shape = tuple(np.array(K1.shape) * 2) | |
| eigen_matrix1 = np.zeros(eigen_shape) | |
| em_view = eigen_matrix1.view() | |
| em_view.shape = 2, eigen_shape[0] // 2, 2, eigen_shape[1] // 2 | |
| em_view = em_view.transpose(0, 2, 1, 3) | |
| eigen_matrix2 = np.zeros(eigen_shape) | |
| em_view2 = eigen_matrix2.view() |
This file contains hidden or 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 torch | |
| from torch import nn | |
| from torch.nn import Parameter, functional as F | |
| class Convolution2DEnergyTemporalBasis(nn.Module): | |
| def __init__(self, n_input_channels, | |
| n_filters_simple, | |
| n_filters_complex, | |
| n_filters_temporal, |
OlderNewer