repo_name
stringlengths
7
90
path
stringlengths
5
191
copies
stringlengths
1
3
size
stringlengths
4
6
content
stringlengths
976
581k
license
stringclasses
15 values
ycaihua/scikit-learn
sklearn/datasets/tests/test_samples_generator.py
67
14842
from __future__ import division from collections import defaultdict from functools import partial import numpy as np from sklearn.externals.six.moves import zip from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_almost_equal fr...
bsd-3-clause
juanmirocks/LocText
scripts/visualize_svm_projected_features.py
2
1385
from __future__ import print_function import random from scipy import sparse from sklearn import datasets from sklearn.model_selection import train_test_split from sklearn.model_selection import GridSearchCV from sklearn.metrics import classification_report from sklearn.svm import SVC from sklearn.decomposition impo...
apache-2.0
rsivapr/scikit-learn
sklearn/manifold/isomap.py
12
7145
"""Isomap for manifold learning""" # Author: Jake Vanderplas -- <vanderplas@astro.washington.edu> # License: BSD 3 clause (C) 2011 import numpy as np from ..base import BaseEstimator, TransformerMixin from ..neighbors import NearestNeighbors, kneighbors_graph from ..utils import check_arrays from ..utils.graph impor...
bsd-3-clause
costypetrisor/scikit-learn
sklearn/linear_model/tests/test_least_angle.py
44
17033
import tempfile import shutil import os.path as op import warnings from nose.tools import assert_equal import numpy as np from scipy import linalg from sklearn.cross_validation import train_test_split from sklearn.externals import joblib from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.t...
bsd-3-clause
GeorgKunk/MachineLearning
Autoencoder_MNIST.py
1
1852
import matplotlib.pyplot as plt from sklearn.datasets import fetch_mldata import pickle import os mnist = fetch_mldata("MNIST original") X, y = mnist.data / 255., mnist.target X_train, X_test = X[:60000], X[60000:] y_train, y_test = y[:60000], y[60000:] def ae_store_name(hidden_units): directory = "storedClassifi...
mit
wronk/mne-python
examples/realtime/rt_feedback_server.py
3
4954
""" ============================================== Real-time feedback for decoding :: Server Side ============================================== This example demonstrates how to setup a real-time feedback mechanism using StimServer and StimClient. The idea here is to display future stimuli for the class which is pred...
bsd-3-clause
IISH/nlgis2
web/api/api.py
1
29784
# Copyright (C) 2014 International Institute of Social History. # @author Vyacheslav Tykhonov # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License, version 3, # as published by the Free Software Foundation. # # This program is distribute...
gpl-3.0
damaggu/SAMRI
samri/examples/registration_qc.py
1
1190
import pandas as pd import statsmodels.api as sm import statsmodels.formula.api as smf from os import path from samri.plotting.aggregate import registration_qc from samri.typesetting import inline_anova data_dir = path.join(path.dirname(path.realpath(__file__)),"../../example_data/") df_path = path.join(data_dir,"f_re...
gpl-3.0
anaguma2261/scikit-learn-sample
ridge_regression.py
1
2421
#coding:utf-8 import numpy import sys import pickle from sklearn.linear_model import Ridge from sklearn.cross_validation import cross_val_score DELIMITOR="," def load_data(data_path="data/YearPredictionMSD.txt"): ''' ƒf[ƒ^‚̓Ǎž YearPredictionMSD https://archive.ics.uci.edu/ml/datasets/YearPredicti...
mit
JosmanPS/scikit-learn
examples/svm/plot_svm_scale_c.py
223
5375
""" ============================================== Scaling the regularization parameter for SVCs ============================================== The following example illustrates the effect of scaling the regularization parameter when using :ref:`svm` for :ref:`classification <svm_classification>`. For SVC classificati...
bsd-3-clause
uglyboxer/linear_neuron
net-p3/lib/python3.5/site-packages/sklearn/neighbors/graph.py
19
6904
"""Nearest Neighbors graph functions""" # Author: Jake Vanderplas <vanderplas@astro.washington.edu> # # License: BSD 3 clause (C) INRIA, University of Amsterdam import warnings from .base import KNeighborsMixin, RadiusNeighborsMixin from .unsupervised import NearestNeighbors def _check_params(X, metric, p, metric_p...
mit
mementum/backtrader
samples/tradingcalendar/tcal-intra.py
1
5833
#!/usr/bin/env python # -*- coding: utf-8; py-indent-offset:4 -*- ############################################################################### # # Copyright (C) 2015-2020 Daniel Rodriguez # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License a...
gpl-3.0
ua-snap/downscale
old/bin/clt_ar5_model_data_preprocess.py
2
12238
#!/usr/bin/python2 # # # pre-processing of raw downloaded CMIP5 data from the PCMDI portal to something that is standardized for # use in later downscaling to ALFRESCO AK/Canada extent and resolution needs. # # # # # def group_input_filenames( prefix, root_dir ): import fnmatch, functools, itertools, os, glob imp...
mit
lukeiwanski/tensorflow
tensorflow/contrib/timeseries/examples/known_anomaly.py
14
7880
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
apache-2.0
DiamondLightSource/auto_tomo_calibration-experimental
measure_resolution/lmfit/ui/ipy_fitter.py
7
10328
import warnings import numpy as np from ..model import Model from .basefitter import MPLFitter, _COMMON_DOC, _COMMON_EXAMPLES_DOC # Note: If IPython is not available of the version is < 2, # this module will not be imported, and a different Fitter. import IPython from IPython.display import display, clear_output # ...
apache-2.0
Morijarti/dota-2-heatmap
heatmap_generator.py
1
10141
import json import numpy from heroes import HEROES __author__ = 'yanbo' import io import os from smoke.io.wrap import demo as io_wrap_demo from smoke.replay import demo as replay_demo from smoke.replay.const import Data import pylab import matplotlib import matplotlib.image import scipy.ndimage import cPickle from map...
mit
yanlend/scikit-learn
examples/gaussian_process/plot_gp_regression.py
253
4054
#!/usr/bin/python # -*- coding: utf-8 -*- r""" ========================================================= Gaussian Processes regression: basic introductory example ========================================================= A simple one-dimensional regression exercise computed in two different ways: 1. A noise-free cas...
bsd-3-clause
asnir/airflow
airflow/www/views.py
3
95451
# -*- coding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software ...
apache-2.0
ibackus/custom_python_packages
isaac.py
1
51159
""" ----------------------------------------------- Some simple python code to be easily imported from python ----------------------------------------------- """ import pynbody SimArray = pynbody.array.SimArray pb = pynbody import copy import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np imp...
mit
olvhammar/GNURadio-FFTS
Software_HRC/Finalize.py
1
9060
#!/usr/bin/env python2 ################################################## # Finalize spectrums ################################################## import ephem import matplotlib.pyplot as plt import numpy as np import math import os import timeit import time import glob import threading import astropy import sys from as...
mit
nikoonia/gem5v
util/stats/output.py
90
7981
# Copyright (c) 2005-2006 The Regents of The University of Michigan # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: redistributions of source code must retain the above copyright # notice, this ...
bsd-3-clause
pxsdirac/tushare
tushare/util/dateu.py
3
2480
# -*- coding:utf-8 -*- import datetime import time import pandas as pd def year_qua(date): mon = date[5:7] mon = int(mon) return[date[0:4], _quar(mon)] def _quar(mon): if mon in [1, 2, 3]: return '1' elif mon in [4, 5, 6]: return '2' elif mon in [7, 8, ...
bsd-3-clause
adore-hrzz/nao-sound-classification
scripts/validator.py
2
2179
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import csv import itertools import numpy as np import matplotlib.pyplot as plt from sklearn import svm, datasets from sklearn.model_selection import train_test_split from sklearn.metrics import confusion_matrix def plot_confusion_matrix(cm, classes, data_type,...
gpl-3.0
erdc-cm/air-water-vv
2d/numericalTanks/nonlinearWaves/postprocess_NLW_all.py
1
6465
import numpy as np import collections as cll import csv import os import matplotlib.pyplot as plt from proteus import WaveTools as wt from AnalysisTools import signalFilter,zeroCrossing,reflStat ##################################################################################### folders = ['A1','A2','A3','A4...
mit
martianstudio/stockanalysis
first_try.py
1
4354
import datetime import numpy as np import pandas as pd import sklearn from pandas.io.data import DataReader from sklearn.linear_model import LogisticRegression from sklearn.lda import LDA from sklearn.qda import QDA from sklearn.svm import SVC """ Feature X: T = Today's Price T - n = The n days before Today [T - 5,...
apache-2.0
annahs/atmos_research
NC_size_distrs_with_variable_coating_bin_at_end_avg_flights.py
1
17996
from pymiecoated import Mie import sys import os import numpy as np from pprint import pprint from datetime import datetime import mysql.connector import math import matplotlib.pyplot as plt import matplotlib.colors import calendar from scipy.optimize import curve_fit cloud_droplet_conc = 0.5 min_coat = 0 #assumed m...
mit
1kastner/analyse_weather_data
plot_weather_data/plot_precipitation_all_pws_stations.py
1
4671
""" You can limit this by - passing the limit=n parameter to station_repository.load_all_stations() - restricting the date range, e.g. plot_station("2016-01-01", "2016-01-31") Depends on filter_weather_data.filters.preparation.average_husconet_temperature -m plot_weather_data.plot_temperature_all_pws_stations """ i...
agpl-3.0
rhyolight/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/ticker.py
69
37420
""" Tick locating and formatting ============================ This module contains classes to support completely configurable tick locating and formatting. Although the locators know nothing about major or minor ticks, they are used by the Axis class to support major and minor tick locating and formatting. Generic t...
agpl-3.0
laosiaudi/tensorflow
tensorflow/contrib/learn/python/learn/estimators/estimators_test.py
15
4396
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
apache-2.0
valexandersaulys/prudential_insurance_kaggle
venv/lib/python2.7/site-packages/sklearn/feature_selection/__init__.py
33
1159
""" The :mod:`sklearn.feature_selection` module implements feature selection algorithms. It currently includes univariate filter selection methods and the recursive feature elimination algorithm. """ from .univariate_selection import chi2 from .univariate_selection import f_classif from .univariate_selection import f_...
gpl-2.0
zhreshold/mxnet-ssd
evaluate/eval_metric.py
1
11378
import mxnet as mx import numpy as np import os import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt class MApMetric(mx.metric.EvalMetric): """ Calculate mean AP for object detection task Parameters: --------- ovp_thresh : float overlap threshold for TP use_difficul...
mit
Odingod/mne-python
mne/surface.py
4
49208
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Matti Hamalainen <msh@nmr.mgh.harvard.edu> # Denis A. Engemann <denis.engemann@gmail.com> # # License: BSD (3-clause) import os from os import path as op import sys from struct import pack from glob import glob import numpy as...
bsd-3-clause
allisony/aplpy
aplpy/tests/test_convolve.py
3
1201
import os import matplotlib matplotlib.use('Agg') import numpy as np from astropy.tests.helper import pytest from astropy.io import fits from astropy.wcs import WCS as AstropyWCS from .helpers import generate_file, generate_hdu, generate_wcs from .. import FITSFigure def test_convolve_default(): data = np.rand...
mit
kambysese/mne-python
examples/datasets/spm_faces_dataset.py
9
4727
""" .. _ex-spm-faces: ========================================== From raw data to dSPM on SPM Faces dataset ========================================== Runs a full pipeline using MNE-Python: - artifact removal - averaging Epochs - forward model computation - source reconstruction using dSPM on the con...
bsd-3-clause
nzufelt/lmlp_theano
solutions/cnn.py
1
6290
""" A convolutional neural network using theano. This script was created by Nicholas Zufelt as a part of the London Machine Learning Practice meetup. Calling this script with an example (may not converge): $ python cnn.py 5 5 3 2 25 100 20 1000 128 .01 .01 Parameters: filter_height -- int, convolution layer filt...
mit
joshloyal/scikit-learn
benchmarks/bench_isolation_forest.py
46
3782
""" ========================================== IsolationForest benchmark ========================================== A test of IsolationForest on classical anomaly detection datasets. """ print(__doc__) from time import time import numpy as np import matplotlib.pyplot as plt from sklearn.ensemble import IsolationFore...
bsd-3-clause
allqoow/exerciseML
week05.py
1
6505
#!/usr/bin/python # -*- coding: utf-8 -*- # # Author : allqoow # Contact : allqoow@gmail.com # Started on: 20161121(yyyymmdd) # Project : exerciseML(Exercise for Machine Learning) # H5.1.A import matplotlib.pyplot import math import numpy.random import numpy.linalg def getNumberRows(mat): return len(mat) de...
mit
modflowpy/flopydoc
docs/pysrc/tutorial1.py
1
1598
import os import sys import numpy as np flopypth = os.path.join('..', '..', 'flopy3.git') if flopypth not in sys.path: sys.path.append(flopypth) import flopy #Assign name and create modflow model object modelname = 'tutorial1' mf = flopy.modflow.Modflow(modelname, exe_name='mf2005') #model domain and grid definit...
bsd-3-clause
argonnexraydetector/RoachFirmPy
Roach2DevelopmentTree/pyfiles/debug.py
1
26132
import itertools from collections import OrderedDict ''' execfile('debug.py') execfile('sim928.py') plotAllRes2File('/home/oxygen31/TMADDEN/ROACH2/datafiles/jul7_2016/res1-5bblb.pdf') /home/oxygen31/TMADDEN/ROACH2/datafiles/jul5_2016 calcBBLOFromRFFreqs( arange(3000e6, 3200e6,20e6)) vlist = arange(10,0,-0.02) ...
gpl-2.0
nhejazi/scikit-learn
doc/tutorial/text_analytics/solutions/exercise_02_sentiment.py
104
3139
"""Build a sentiment analysis / polarity model Sentiment analysis can be casted as a binary text classification problem, that is fitting a linear classifier on features extracted from the text of the user messages so as to guess wether the opinion of the author is positive or negative. In this examples we will use a ...
bsd-3-clause
mdepasca/miniature-adventure
util/IO.py
1
12197
import numpy as np import pandas as pd import subprocess import os import classes def get_sn_from_file(pathToSN, magFlag=False): """Reads photometric data of SN from file formatted as in SNPhotCC Keyword arguments: pathToSN -- path to file from which extract data. Returns: sn -- object of class ...
unlicense
nrhine1/scikit-learn
sklearn/svm/tests/test_bounds.py
280
2541
import nose from nose.tools import assert_equal, assert_true from sklearn.utils.testing import clean_warning_registry import warnings import numpy as np from scipy import sparse as sp from sklearn.svm.bounds import l1_min_c from sklearn.svm import LinearSVC from sklearn.linear_model.logistic import LogisticRegression...
bsd-3-clause
podhrmic/paparazzi
sw/ground_segment/python/gvf/gvfframe.py
4
13633
import wx import time from scipy import linalg as la from matplotlib.path import Path from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas import matplotlib.pyplot as pl import matplotlib.patches as patches import numpy as np import sys from os import path, getenv PPRZ_SRC = getenv("PAPARAZ...
gpl-2.0
saimn/glue
setup.py
1
4848
#!/usr/bin/env python from __future__ import print_function from setuptools import setup, find_packages from distutils.core import Command import os import re import sys import subprocess # Generate version.py with open('glue/version.py') as infile: exec(infile.read()) # If the version is not stable, we can ad...
bsd-3-clause
rosswhitfield/mantid
scripts/DGSPlanner/InstrumentSetupWidget.py
3
16000
# Mantid Repository : https://github.com/mantidproject/mantid # # Copyright &copy; 2018 ISIS Rutherford Appleton Laboratory UKRI, # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + #pyl...
gpl-3.0
Obus/scikit-learn
examples/calibration/plot_calibration_curve.py
225
5903
""" ============================== Probability Calibration curves ============================== When performing classification one often wants to predict not only the class label, but also the associated probability. This probability gives some kind of confidence on the prediction. This example demonstrates how to di...
bsd-3-clause
michelp/pywt
demo/dwt2_dwtn_image.py
3
1732
#!/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as plt import pywt import pywt.data # Load image original = pywt.data.aero() # Wavelet transform of image, and plot approximation and details titles = ['Approximation', ' Horizontal detail', 'Vertical detail', 'Diag...
mit
gbtimmon/ase16GBT
code/8/NSGA.py
1
7785
#%matplotlib inline # All the imports from __future__ import print_function, division import matplotlib.pyplot as plt import os.path from Model import * from DTLZ import * def refresh_objectives(problem, population): for i, obj in enumerate(problem.objectives): scores = [point.objectives[i] for point in p...
unlicense
PrashntS/scikit-learn
examples/svm/plot_svm_nonlinear.py
268
1091
""" ============== Non-linear SVM ============== Perform binary classification using non-linear SVC with RBF kernel. The target to predict is a XOR of the inputs. The color map illustrates the decision function learned by the SVC. """ print(__doc__) import numpy as np import matplotlib.pyplot as plt from sklearn imp...
bsd-3-clause
pkruskal/scikit-learn
examples/plot_multilabel.py
236
4157
# Authors: Vlad Niculae, Mathieu Blondel # License: BSD 3 clause """ ========================= Multilabel classification ========================= This example simulates a multi-label document classification problem. The dataset is generated randomly based on the following process: - pick the number of labels: n ...
bsd-3-clause
jeremymcrae/denovoFilter
denovoFilter/missing_symbols.py
1
5967
""" Copyright (c) 2016 Genome Research Ltd. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distr...
mit
spatialaudio/sweep
log_sweep_kaiser_window_bandlimited_script5/log_sweep_kaiser_window_bandlimited_script5.py
2
2156
#!/usr/bin/env python3 """The influence of windowing of log. bandlimited sweep signals when using a Kaiser Window by fixing beta (=2) and fade_out (=0). fstart = 100 Hz fstop = 5000 Hz """ import sys sys.path.append('..') import measurement_chain import plotting import calculation import ir_imitation impo...
mit
dryadb11781/machine-learning-python
cross_decomposition/plot_compare_cross_decomposition.py
128
4761
""" =================================== Compare cross decomposition methods =================================== Simple usage of various cross decomposition algorithms: - PLSCanonical - PLSRegression, with multivariate response, a.k.a. PLS2 - PLSRegression, with univariate response, a.k.a. PLS1 - CCA Given 2 multivari...
bsd-3-clause
IvarsKarpics/mxcube
gui/bricks/ESRF/ESRFCenteringBrick.py
1
14511
# # Project: MXCuBE # https://github.com/mxcube # # This file is part of MXCuBE software. # # MXCuBE is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your...
lgpl-3.0
boland1992/SeisSuite
seissuite/sort_later/inverse_clustering.py
2
11741
# -*- coding: utf-8 -*- """ Created on Mon Jun 20 12:28:32 2015 @author: boland """ import sys sys.path.append('/home/boland/Anaconda/lib/python2.7/site-packages') import pickle import numpy as np import matplotlib.pyplot as plt from scipy.cluster.vq import kmeans import multiprocessing as mp import pyproj import os ...
gpl-3.0
jlnh/SeizurePrediction
seizure/tasks.py
1
23718
from collections import namedtuple import os.path import numpy as np import pylab as pl import scipy.io import common.time as time from sklearn import cross_validation, preprocessing from sklearn.metrics import roc_curve, auc from scipy.signal import resample from sklearn.linear_model import LogisticRegression as LR fr...
mit
eweill/ConwayGameOfLife
src/python/conway.py
1
28326
# Import necessary libraries import matplotlib.pyplot as plt from random import randint from copy import deepcopy import numpy as np import unittest, sys import math from GoLquadtree import GoLNode, GoLQuadTree #import pylab # Conway Game of Life Grid Class class ConwayGOLGrid(): """ Represents a grid in the ...
mit
Srisai85/scikit-learn
sklearn/tests/test_kernel_ridge.py
342
3027
import numpy as np import scipy.sparse as sp from sklearn.datasets import make_regression from sklearn.linear_model import Ridge from sklearn.kernel_ridge import KernelRidge from sklearn.metrics.pairwise import pairwise_kernels from sklearn.utils.testing import ignore_warnings from sklearn.utils.testing import assert...
bsd-3-clause
GuessWhoSamFoo/pandas
pandas/tests/plotting/test_hist_method.py
1
15812
# coding: utf-8 """ Test cases for .hist method """ import numpy as np from numpy.random import randn import pytest import pandas.util._test_decorators as td from pandas import DataFrame, Series from pandas.tests.plotting.common import TestPlotBase, _check_plot_works import pandas.util.testing as tm from pandas.pl...
bsd-3-clause
Tong-Chen/scikit-learn
examples/mixture/plot_gmm_selection.py
8
3193
""" ================================= Gaussian Mixture Model Selection ================================= This example shows that model selection can be performed with Gaussian Mixture Models using information-theoretic criteria (BIC). Model selection concerns both the covariance type and the number of components in th...
bsd-3-clause
dhruvparamhans/zipline
zipline/history/history.py
2
10716
# # Copyright 2014 Quantopian, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
apache-2.0
yanlend/scikit-learn
sklearn/decomposition/tests/test_incremental_pca.py
297
8265
"""Tests for Incremental PCA.""" import numpy as np from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_raises from sklearn import datasets from sklearn.decomposition import PCA, IncrementalPCA iris = datasets.load...
bsd-3-clause
thilbern/scikit-learn
sklearn/grid_search.py
12
30036
""" The :mod:`sklearn.grid_search` includes utilities to fine-tune the parameters of an estimator. """ from __future__ import print_function # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>, # Gael Varoquaux <gael.varoquaux@normalesup.org> # Andreas Mueller <amueller@ais.uni-bonn.de> # ...
bsd-3-clause
justincassidy/scikit-learn
examples/calibration/plot_calibration.py
225
4795
""" ====================================== Probability calibration of classifiers ====================================== When performing classification you often want to predict not only the class label, but also the associated probability. This probability gives you some kind of confidence on the prediction. However,...
bsd-3-clause
kenshay/ImageScripter
ProgramData/SystemFiles/Python/Lib/site-packages/scipy/ndimage/fourier.py
15
11266
# Copyright (C) 2003-2005 Peter J. Verveer # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following d...
gpl-3.0
DonBeo/statsmodels
statsmodels/tsa/x13.py
7
23281
""" Run x12/x13-arima specs in a subprocess from Python and curry results back into python. Notes ----- Many of the functions are called x12. However, they are also intended to work for x13. If this is not the case, it's a bug. """ from __future__ import print_function import os import subprocess import tempfile impor...
bsd-3-clause
RachitKansal/scikit-learn
sklearn/linear_model/bayes.py
220
15248
""" Various bayesian regression """ from __future__ import print_function # Authors: V. Michel, F. Pedregosa, A. Gramfort # License: BSD 3 clause from math import log import numpy as np from scipy import linalg from .base import LinearModel from ..base import RegressorMixin from ..utils.extmath import fast_logdet, p...
bsd-3-clause
BhallaLab/moose
moose-examples/neuroml2/run_cell.py
2
2868
# -*- coding: utf-8 -*- # run_cell.py --- # # Filename: run_cell.py # Description: # Author: # Maintainer: P Gleeson # Version: # URL: # Keywords: # Compatibility: # # # Commentary: # # # # # Change log: # Sunday 16 September 2018 10:04:24 AM IST # - Tweaked file to to make it compatible with moose. # # # # T...
gpl-3.0
yunfeilu/scikit-learn
sklearn/utils/estimator_checks.py
21
51976
from __future__ import print_function import types import warnings import sys import traceback import inspect import pickle from copy import deepcopy import numpy as np from scipy import sparse import struct from sklearn.externals.six.moves import zip from sklearn.externals.joblib import hash, Memory from sklearn.ut...
bsd-3-clause
cloudera/ibis
ibis/tests/sql/test_compiler.py
1
69036
import datetime import unittest import pytest import ibis import ibis.expr.api as api import ibis.expr.operations as ops from ibis.backends.base_sql.compiler import BaseDialect, build_ast, to_sql from ibis.tests.expr.mocks import MockConnection pytest.importorskip('sqlalchemy') class TestASTBuilder(unittest.TestCa...
apache-2.0
mirceamironenco/GANs
basic_gan.py
1
4869
from datetime import datetime import argparse import tensorflow as tf import numpy as np import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec from helpers.utils import load_mnist, print_flags from helpers.initializers import he_xavier BATCH_SIZE = 128 LEARNING_RATE = 1e-3 EPOCHS = 75 Z_DIM = 100 cl...
mit
Obus/scikit-learn
sklearn/utils/validation.py
66
23629
"""Utilities for input validation""" # Authors: Olivier Grisel # Gael Varoquaux # Andreas Mueller # Lars Buitinck # Alexandre Gramfort # Nicolas Tresegnie # License: BSD 3 clause import warnings import numbers import numpy as np import scipy.sparse as sp from ..externals i...
bsd-3-clause
klocey/ScalingMicroBiodiversity
ExtraTests/lognormal/Prestons_a.py
2
2188
from __future__ import division #from bigfloat import BigFloat, sqrt, exp, log, log2, erf, const_pi import numpy as np import math from numpy import log, log2, exp, sqrt,log10 from scipy.optimize import fsolve import scipy.optimize as opt import matplotlib.pyplot as plt from scipy.special import erf import sys pi = ma...
gpl-3.0
pompiduskus/scikit-learn
sklearn/datasets/mldata.py
309
7838
"""Automatically download MLdata datasets.""" # Copyright (c) 2011 Pietro Berkes # License: BSD 3 clause import os from os.path import join, exists import re import numbers try: # Python 2 from urllib2 import HTTPError from urllib2 import quote from urllib2 import urlopen except ImportError: # Pyt...
bsd-3-clause
jmetzen/scikit-learn
examples/mixture/plot_gmm_classifier.py
22
4015
""" ================== GMM classification ================== Demonstration of Gaussian mixture models for classification. See :ref:`gmm` for more information on the estimator. Plots predicted labels on both training and held out test data using a variety of GMM classifiers on the iris dataset. Compares GMMs with sp...
bsd-3-clause
rhattersley/cartopy
lib/cartopy/examples/geostationary.py
4
2106
""" Reprojecting images from a Geostationary projection --------------------------------------------------- This example demonstrates Cartopy's ability to project images into the desired projection on-the-fly. The image itself is retrieved from a URL and is loaded directly into memory without storing it intermediately...
lgpl-3.0
uds-se/backstage
scripts/tag_lemma.py
1
7801
import argparse import csv import re import numpy import pandas import webcolors from gensim.models import Word2Vec from nltk.corpus import stopwords, wordnet, words from spacy.en import English # data_dir = os.environ.get('SPACY_DATA', LOCAL_DATA_DIR) class Filter(object): model_file = 'data/GoogleNews-vector...
gpl-3.0
hainm/statsmodels
statsmodels/tsa/statespace/tests/test_mlemodel.py
10
16681
""" Tests for the generic MLEModel Author: Chad Fulton License: Simplified-BSD """ from __future__ import division, absolute_import, print_function import numpy as np import pandas as pd import os import re import warnings from statsmodels.tsa.statespace import sarimax, kalman_filter from statsmodels.tsa.statespace....
bsd-3-clause
nsdf/nsdf
examples/datadump/test_parse_datadump_spikes.py
1
10724
import os import h5py import bisect import numpy as np import pandas as pd import nsdf def iter_loadtxt(filename, delimiter='\t', skiprows=0, dtype=float): def iter_func(): with open(filename, 'r') as infile: for _ in range(skiprows): next(infile) for line in infile:...
gpl-3.0
SGMAP-AGD/anonymisation
examples/Transparence Santé/import_insee.py
1
2349
import pandas as pd # Nouvelle fonction pour expand la base insee, afin de pouvoir l'intégrer ensuite à la base transparence # Prend en arguments : # - les données INSEE sous forme de dataframe, groupées par département # - annuaire de correspondances entre les professions INSEE et les professions Transparence Santé ...
gpl-3.0
datapythonista/pandas
pandas/tests/groupby/conftest.py
3
3451
import numpy as np import pytest from pandas import ( DataFrame, MultiIndex, ) import pandas._testing as tm from pandas.core.groupby.base import ( reduction_kernels, transformation_kernels, ) @pytest.fixture def mframe(): index = MultiIndex( levels=[["foo", "bar", "baz", "qux"], ["one", "...
bsd-3-clause
openhumanoids/exotica
exotations/solvers/exotica_ddp_solver/test/test_boxqp_configurations.py
2
2944
#!/usr/bin/env python from __future__ import print_function, division import matplotlib.pyplot as plt import pyexotica as exo from collections import OrderedDict def test_solver(use_new_boxqp, use_polynomial_linesearch, use_cholesky): config = '{exotica_examples}/resources/configs/dynamic_time_indexed/13_control...
bsd-3-clause
akionakamura/scikit-learn
examples/covariance/plot_lw_vs_oas.py
248
2903
""" ============================= Ledoit-Wolf vs OAS estimation ============================= The usual covariance maximum likelihood estimate can be regularized using shrinkage. Ledoit and Wolf proposed a close formula to compute the asymptotically optimal shrinkage parameter (minimizing a MSE criterion), yielding th...
bsd-3-clause
Musicophilia/nga_hacks
flask/src/cnn_processing.py
1
3047
import numpy as np from preprocessing import * from sklearn.cross_validation import train_test_split degree_interval = 0.08 num_timesteps = 10 def fill_grid(grid, clean_dict, cardinals): north, south, east, west = cardinals grid_province_dict = {} for province, rows in clean_dict.iteritems(): rows...
mit
jayrambhia/SimpleCV2
SimpleCV/LineScan.py
2
35420
from SimpleCV.base import * import scipy.signal as sps import scipy.optimize as spo import numpy as np import copy, operator class LineScan(list): """ **SUMMARY** A line scan is a one dimensional signal pulled from the intensity of a series of a pixels in an image. LineScan allows you to do a series...
bsd-3-clause
mbayon/TFG-MachineLearning
venv/lib/python3.6/site-packages/pandas/core/reshape/pivot.py
6
20058
# pylint: disable=E1103 from pandas.core.dtypes.common import is_list_like, is_scalar from pandas.core.reshape.concat import concat from pandas import Series, DataFrame, MultiIndex, Index from pandas.core.groupby import Grouper from pandas.core.reshape.util import cartesian_product from pandas.compat import range, lr...
mit
kstory8/egret
egret/psfmakers/despsfmaker.py
2
7218
#!/usr/bin/env python import os import sys import numpy as np import galsim from .psfmaker import PSFMaker from ..observation import Observation class DESPSFMaker(PSFMaker): """ make a DES-like PSF from esheldon's fork of the great3 code blessed by Mike and Aaron to roughly match DES M. R...
bsd-3-clause
herilalaina/scikit-learn
examples/svm/plot_svm_nonlinear.py
62
1119
""" ============== Non-linear SVM ============== Perform binary classification using non-linear SVC with RBF kernel. The target to predict is a XOR of the inputs. The color map illustrates the decision function learned by the SVC. """ print(__doc__) import numpy as np import matplotlib.pyplot as plt from sklearn imp...
bsd-3-clause
yarden-livnat/regulus
regulus/core/data.py
1
1531
import pandas as pd from sklearn.preprocessing import StandardScaler class Data(object): def __init__(self, x, values): self.x = pd.DataFrame(x) self.values = pd.DataFrame(values) self.scaler = None @staticmethod def read_csv(filename, ndims=None): return Data.from_df(pd.r...
bsd-3-clause
florentchandelier/keras
examples/addition_rnn.py
50
5900
# -*- coding: utf-8 -*- from __future__ import print_function from keras.models import Sequential, slice_X from keras.layers.core import Activation, Dense, RepeatVector from keras.layers import recurrent from sklearn.utils import shuffle import numpy as np """ An implementation of sequence to sequence learning for per...
mit
Irsan88/SeqTools
DataProcessing/roda/branches/irna/bin/scripts/new_qc_v6.py
6
35920
#!/usr/bin/env python # Script based on qc.R R-script by sdentro # Daphne van Beek import matplotlib import sys from pylab import * from reportlab.lib import colors as ncolors from reportlab.lib.pagesizes import letter, inch from reportlab.platypus import SimpleDocTemplate, Table, TableStyle, Paragraph, Image, Spacer...
gpl-2.0
stefanseefeld/numba
numba/tests/test_extending.py
1
12725
from __future__ import print_function, division, absolute_import from collections import namedtuple import math import sys import numpy as np from numba import unittest_support as unittest from numba import jit, types, errors, typeof, numpy_support, cgutils from numba.compiler import compile_isolated from .support i...
bsd-2-clause
lbishal/scikit-learn
examples/calibration/plot_compare_calibration.py
241
5008
""" ======================================== Comparison of Calibration of Classifiers ======================================== Well calibrated classifiers are probabilistic classifiers for which the output of the predict_proba method can be directly interpreted as a confidence level. For instance a well calibrated (bi...
bsd-3-clause
jayflo/scikit-learn
doc/datasets/mldata_fixture.py
367
1183
"""Fixture module to skip the datasets loading when offline Mock urllib2 access to mldata.org and create a temporary data folder. """ from os import makedirs from os.path import join import numpy as np import tempfile import shutil from sklearn import datasets from sklearn.utils.testing import install_mldata_mock fr...
bsd-3-clause
ChanderG/scikit-learn
sklearn/cluster/tests/test_hierarchical.py
230
19795
""" Several basic tests for hierarchical clustering procedures """ # Authors: Vincent Michel, 2010, Gael Varoquaux 2012, # Matteo Visconti di Oleggio Castello 2014 # License: BSD 3 clause from tempfile import mkdtemp import shutil from functools import partial import numpy as np from scipy import sparse from...
bsd-3-clause
cjayb/mne-python
mne/preprocessing/ica.py
1
113755
# -*- coding: utf-8 -*- # # Authors: Denis A. Engemann <denis.engemann@gmail.com> # Alexandre Gramfort <alexandre.gramfort@inria.fr> # Juergen Dammers <j.dammers@fz-juelich.de> # # License: BSD (3-clause) from inspect import isfunction from collections import namedtuple from copy import deepcopy from...
bsd-3-clause
IntelLabs/hpat
sdc/datatypes/hpat_pandas_rolling_types.py
1
9782
# ***************************************************************************** # Copyright (c) 2020, Intel Corporation All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # Redistributions of sou...
bsd-2-clause
zrhans/pythonanywhere
.virtualenvs/django19/lib/python3.4/site-packages/pandas/core/panelnd.py
10
3665
""" Factory methods to create N-D panels """ from pandas.compat import zip import pandas.compat as compat def create_nd_panel_factory(klass_name, orders, slices, slicer, aliases=None, stat_axis=2, info_axis=0, ns=None): """ manufacture a n-d class: Parameters --------...
apache-2.0
thientu/scikit-learn
sklearn/cluster/tests/test_bicluster.py
226
9457
"""Testing for Spectral Biclustering methods""" import numpy as np from scipy.sparse import csr_matrix, issparse from sklearn.grid_search import ParameterGrid from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_equal from...
bsd-3-clause
ajrichards/bayesian-examples
visualization/mpl-event-picking.py
3
2345
import numpy as np class PointBrowser(object): """ Click on a point to select and highlight it -- the data that generated the point will be shown in the lower axes. Use the 'n' and 'p' keys to browse through the next and previous points """ def __init__(self): self.lastind = 0 ...
bsd-3-clause