repo_name
stringlengths
6
67
path
stringlengths
5
185
copies
stringlengths
1
3
size
stringlengths
4
6
content
stringlengths
1.02k
962k
license
stringclasses
15 values
fabianp/scikit-learn
sklearn/neighbors/unsupervised.py
106
4461
"""Unsupervised nearest neighbors learner""" from .base import NeighborsBase from .base import KNeighborsMixin from .base import RadiusNeighborsMixin from .base import UnsupervisedMixin class NearestNeighbors(NeighborsBase, KNeighborsMixin, RadiusNeighborsMixin, UnsupervisedMixin): """Unsu...
bsd-3-clause
vishnumani2009/OpenSource-Open-Ended-Statistical-toolkit
FRONTEND/pyroc.py
2
12161
#!/usr/bin/env python # encoding: utf-8 """ PyRoc.py Created by Marcel Caraciolo on 2009-11-16. Copyright (c) 2009 Federal University of Pernambuco. All rights reserved. IMPORTANT: Based on the original code by Eithon Cadag (http://www.eithoncadag.com/files/pyroc.txt) Python Module for calculating the area under the...
gpl-3.0
dpsfotocestou/SkyDrop
skydrop/utils/serial_chart/chart_3D.py
5
2332
import serial import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import numpy as np def add_line(name, x, index): item = {} item["name"] = name item["data"] = np.zeros(len(x)) item["index"] = index item["axis"] = False return item time = np.arange(2) y = [] y.append(a...
gpl-2.0
dominiktomicevic/pedestrian
classifier/extractor.py
1
6723
from itertools import product, repeat, chain, ifilter, imap from multiprocessing import Pool, cpu_count from sklearn.preprocessing import binarize from utils.profiling import profile from numpy.random import randint from functools import partial from random import sample import numpy as np import logging logger = logg...
mit
shyamalschandra/scikit-learn
sklearn/model_selection/_split.py
8
55300
""" The :mod:`sklearn.model_selection._split` module includes classes and functions to split the data based on a preset strategy. """ # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>, # Gael Varoquaux <gael.varoquaux@normalesup.org>, # Olivier Girsel <olivier.grisel@ensta.org> # Ragha...
bsd-3-clause
StingraySoftware/stingray
stingray/deadtime/model.py
1
4595
from stingray.utils import njit, prange import numpy as np import matplotlib.pyplot as plt from astropy import log try: from scipy.special import factorial except ImportError: from scipy.misc import factorial __FACTORIALS = factorial(np.arange(160)) def r_in(td, r_0): """Calculate incident countrate g...
mit
bsipocz/statsmodels
statsmodels/examples/ex_multivar_kde.py
34
1504
from __future__ import print_function import numpy as np import matplotlib.pyplot as plt from matplotlib import cm from mpl_toolkits.mplot3d import axes3d import statsmodels.api as sm """ This example illustrates the nonparametric estimation of a bivariate bi-modal distribution that is a mixture of two normal distri...
bsd-3-clause
waddell/urbansim
urbansim/models/regression.py
5
33858
""" Use the ``RegressionModel`` class to fit a model using statsmodels' OLS capability and then do subsequent prediction. """ from __future__ import print_function import logging import numpy as np import pandas as pd import statsmodels.formula.api as smf from patsy import dmatrix from prettytable import PrettyTable...
bsd-3-clause
poojavade/Genomics_Docker
Dockerfiles/gedlab-khmer-filter-abund/pymodules/python2.7/lib/python/statsmodels-0.5.0-py2.7-linux-x86_64.egg/statsmodels/tools/tests/test_tools.py
3
17257
""" Test functions for models.tools """ import numpy as np from numpy.random import standard_normal from numpy.testing import (assert_equal, assert_array_equal, assert_almost_equal, assert_string_equal, TestCase) from nose.tools import (assert_true, assert_false, assert_raises) from statsmo...
apache-2.0
HHammond/PrettyPandas
test/test_pretty_pandas.py
1
2421
import copy import pytest import numpy as np import pandas as pd from prettypandas import PrettyPandas @pytest.fixture() def dataframe(): np.random.seed(24) df = pd.DataFrame({'A': np.linspace(1, 10, 10)}) df = pd.concat([df, pd.DataFrame(np.random.randn(10, 4), colu...
mit
VladimirTyrin/urbansim
urbansim/models/util.py
5
9254
""" Utilities used within the ``urbansim.models`` package. """ import collections import logging import numbers from StringIO import StringIO from tokenize import generate_tokens, NAME import numpy as np import pandas as pd import patsy from zbox import toolz as tz from ..utils.logutil import log_start_finish logge...
bsd-3-clause
andrebrener/crypto_predictor
backtest.py
1
2740
# ============================================================================= # File: backtest.py # Author: Andre Brener # Created: 12 Jun 2017 # Last Modified: 14 Jun 2017 # Description: description # ============================================================================= from datetime ...
mit
suiyuan2009/tensorflow
tensorflow/python/estimator/inputs/queues/feeding_queue_runner_test.py
116
5164
# 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
kernc/scikit-learn
sklearn/neighbors/approximate.py
40
22369
"""Approximate nearest neighbor search""" # Author: Maheshakya Wijewardena <maheshakya.10@cse.mrt.ac.lk> # Joel Nothman <joel.nothman@gmail.com> import numpy as np import warnings from scipy import sparse from .base import KNeighborsMixin, RadiusNeighborsMixin from ..base import BaseEstimator from ..utils.va...
bsd-3-clause
pyspace/pyspace
pySPACE/run/launch.py
2
16052
#!/usr/bin/env python """ Main program to run pySPACE For further instructions take a look at the pySPACE documentation and the tutorials in there! .. note:: Due to errors in configuration files, data or the software, the software may crash. Because of internal parallelization and threading, it is currently ...
bsd-3-clause
airbnb/superset
tests/model_tests.py
1
14095
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
apache-2.0
duerrp/pyexperiment
docs/conf.py
4
12427
# -*- coding: utf-8 -*- # # pyexperiment documentation build configuration file, created by # sphinx-quickstart on Sat Apr 25 13:55:57 2015. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. ...
mit
tranlyvu/kaggle
Digit Recognizer/main/second_attempt.py
1
2058
""" The script generate submission file for the kaggle contest "Digit recognizer",An image recognition contest whose challenge was to classify handwritten single digits dimensionality reduction with PCA+randomforest selection Predictive model: svm """ import pandas as pd import numpy as np from sklearn.svm impor...
apache-2.0
kjung/scikit-learn
examples/neural_networks/plot_mnist_filters.py
57
2195
""" ===================================== Visualization of MLP weights on MNIST ===================================== Sometimes looking at the learned coefficients of a neural network can provide insight into the learning behavior. For example if weights look unstructured, maybe some were not used at all, or if very l...
bsd-3-clause
Alexoner/mooc
cs231n/assignment2/cs231n/activation_statistics.py
1
1817
#!/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as plt def activation_statistics(init_func=lambda fan_in, fan_out: np.random.randn(fan_in, fan_out) * 0.001, nonlinearity='tanh'): """TODO: Docstring for activation_statistics. Demonstrate activation statistics with diff...
apache-2.0
Carralex/landlab
landlab/ca/examples/turbulent_suspension_with_settling_and_bleaching.py
4
16830
#!/usr/env/python """ isotropic_turbulent_suspension_with_settling_and_bleaching.py Example of a continuous-time, stochastic, pair-based cellular automaton model, which simulates the diffusion of suspended particles in a turbulent fluid. Particles start with an accumulated luminescence signal L = 1, and are bleached ...
mit
patrick-winter-knime/deep-learning-on-molecules
autoencoder_features/util/random_forest.py
2
1688
from sklearn.ensemble import RandomForestClassifier from sklearn.externals import joblib import numpy from progressbar import ProgressBar def train(train_data_input, train_data_output, model_path, nr_trees=1000): train_data_input = numerical_to_features(train_data_input) random_forest = RandomForestClassifier...
gpl-3.0
alexmojaki/odo
odo/backends/tests/test_sparksql.py
2
6058
from __future__ import print_function, absolute_import, division import pytest pyspark = pytest.importorskip('pyspark') py4j = pytest.importorskip('py4j') import os import shutil import json import tempfile from contextlib import contextmanager import toolz from toolz.compatibility import map from pyspark.sql impo...
bsd-3-clause
petrbel/PscKonvertor
psc_konvertor/__init__.py
2
1828
# -*- coding: utf-8 -*- import os import pandas __author__ = 'Petr Belohlavek <me@petrbel.cz>' print() class PscKonvertor: """Konvertuje postovni smerovaci cisla na prislusne okresy a kraje. Vyhledavani je pro maximalni rychlost indexovane.""" _MODULE_PATH = os.path.dirname(os.path.abspath(__file__...
mit
devanshdalal/scikit-learn
examples/applications/plot_out_of_core_classification.py
51
13651
""" ====================================================== Out-of-core classification of text documents ====================================================== This is an example showing how scikit-learn can be used for classification using an out-of-core approach: learning from data that doesn't fit into main memory. ...
bsd-3-clause
plotly/plotly.py
packages/python/plotly/plotly/tests/test_optional/test_px/test_px_input.py
1
19349
import plotly.express as px import plotly.graph_objects as go import numpy as np import pandas as pd import pytest from plotly.express._core import build_dataframe from pandas.testing import assert_frame_equal def test_numpy(): fig = px.scatter(x=[1, 2, 3], y=[2, 3, 4], color=[1, 3, 9]) assert np.all(fig.data...
mit
BoltzmannBrain/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/backends/__init__.py
72
2225
import matplotlib import inspect import warnings # ipython relies on interactive_bk being defined here from matplotlib.rcsetup import interactive_bk __all__ = ['backend','show','draw_if_interactive', 'new_figure_manager', 'backend_version'] backend = matplotlib.get_backend() # validates, to match all_bac...
agpl-3.0
466152112/scikit-learn
sklearn/cluster/tests/test_mean_shift.py
121
3429
""" Testing for mean shift clustering methods """ import numpy as np import warnings from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_false from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import asser...
bsd-3-clause
karstenw/nodebox-pyobjc
examples/Extended Application/matplotlib/examples/misc/pythonic_matplotlib.py
1
3300
""" =================== Pythonic Matplotlib =================== Some people prefer to write more pythonic, object-oriented code rather than use the pyplot interface to matplotlib. This example shows you how. Unless you are an application developer, I recommend using part of the pyplot interface, particularly the fig...
mit
rs2/pandas
pandas/tests/indexes/ranges/test_range.py
1
16923
import numpy as np import pytest from pandas.core.dtypes.common import ensure_platform_int import pandas as pd from pandas import Float64Index, Index, Int64Index, RangeIndex import pandas._testing as tm from ..test_numeric import Numeric # aliases to make some tests easier to read RI = RangeIndex I64 = Int64Index F...
bsd-3-clause
michelle192837/test-infra
hack/analyze-memory-profiles.py
9
6137
#!/usr/bin/env python3 # Copyright 2021 The Kubernetes Authors. # # 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 appl...
apache-2.0
kjung/scikit-learn
sklearn/datasets/tests/test_kddcup99.py
59
1336
"""Test kddcup99 loader. Only 'percent10' mode is tested, as the full data is too big to use in unit-testing. The test is skipped if the data wasn't previously fetched and saved to scikit-learn data folder. """ import errno from sklearn.datasets import fetch_kddcup99 from sklearn.utils.testing import assert_equal, S...
bsd-3-clause
jmschrei/scikit-learn
examples/svm/plot_iris.py
225
3252
""" ================================================== Plot different SVM classifiers in the iris dataset ================================================== Comparison of different linear SVM classifiers on a 2D projection of the iris dataset. We only consider the first 2 features of this dataset: - Sepal length - Se...
bsd-3-clause
valexandersaulys/airbnb_kaggle_contest
venv/lib/python3.4/site-packages/pandas/io/tests/test_sql.py
9
102928
"""SQL io tests The SQL tests are broken down in different classes: - `PandasSQLTest`: base class with common methods for all test classes - Tests for the public API (only tests with sqlite3) - `_TestSQLApi` base class - `TestSQLApi`: test the public API with sqlalchemy engine - `TestSQLiteFallbackApi`: t...
gpl-2.0
xxd3vin/spp-sdk
opt/Python27/Lib/site-packages/numpy/lib/recfunctions.py
23
34483
""" Collection of utilities to manipulate structured arrays. Most of these functions were initially implemented by John Hunter for matplotlib. They have been rewritten and extended for convenience. """ import sys import itertools import numpy as np import numpy.ma as ma from numpy import ndarray, recarray from nump...
mit
harisbal/pandas
pandas/tests/series/test_duplicates.py
2
4227
# coding=utf-8 import numpy as np import pytest from pandas import Categorical, Series import pandas.util.testing as tm def test_value_counts_nunique(): # basics.rst doc example series = Series(np.random.randn(500)) series[20:500] = np.nan series[10:20] = 5000 result = series.nunique() asser...
bsd-3-clause
poldrack/myconnectome
myconnectome/rnaseq/predict_svm_behav_rnaseq.py
2
2055
""" use SVM to predict outcome variables based on connectivity """ import numpy import sklearn.preprocessing import sklearn.linear_model import scipy.stats from run_classification import run_classification from load_myconnectome_data import * xvar_names=['panas.positive','panas.negative','panas.fatigue','afterscan.A...
mit
kdebrab/pandas
pandas/tests/indexes/multi/test_copy.py
2
4111
# -*- coding: utf-8 -*- from copy import copy, deepcopy import pandas.util.testing as tm from pandas import (CategoricalIndex, IntervalIndex, MultiIndex, PeriodIndex, RangeIndex, Series, compat) def assert_multiindex_copied(copy, original): # Levels should be (at least, shallow copied) t...
bsd-3-clause
yyjiang/scikit-learn
sklearn/feature_extraction/tests/test_text.py
75
34122
from __future__ import unicode_literals import warnings from sklearn.feature_extraction.text import strip_tags from sklearn.feature_extraction.text import strip_accents_unicode from sklearn.feature_extraction.text import strip_accents_ascii from sklearn.feature_extraction.text import HashingVectorizer from sklearn.fe...
bsd-3-clause
nouiz/pylearn2
pylearn2/models/svm.py
21
3386
"""Wrappers for SVM models.""" __authors__ = "Ian Goodfellow" __copyright__ = "Copyright 2010-2012, Universite de Montreal" __credits__ = ["Ian Goodfellow"] __license__ = "3-clause BSD" __maintainer__ = "LISA Lab" __email__ = "pylearn-dev@googlegroups" import numpy as np import warnings try: from sklearn.multicla...
bsd-3-clause
sdvillal/manysources
manysources/analyses/better_or_worse_coocc.py
1
6541
''' For each experiment: are the resulting losses (or AUC) better or worse than average? ''' from manysources.analyses.losses import read_losses from collections import defaultdict import pandas as pd import numpy as np def average_loss(dset, feats, model, lso, calibration): """ At each expid, we get 1 loss p...
bsd-3-clause
NelisVerhoef/scikit-learn
sklearn/tree/export.py
78
15814
""" This module defines export functions for decision trees. """ # Authors: Gilles Louppe <g.louppe@gmail.com> # Peter Prettenhofer <peter.prettenhofer@gmail.com> # Brian Holt <bdholt1@gmail.com> # Noel Dawe <noel@dawe.me> # Satrajit Gosh <satrajit.ghosh@gmail.com> # Trevor...
bsd-3-clause
datapythonista/pandas
pandas/core/internals/base.py
1
4002
""" Base class for the internal managers. Both BlockManager and ArrayManager inherit from this class. """ from typing import ( List, Optional, TypeVar, ) from pandas._typing import ( DtypeObj, Shape, final, ) from pandas.errors import AbstractMethodError from pandas.core.dtypes.cast import fin...
bsd-3-clause
LohithBlaze/scikit-learn
examples/mixture/plot_gmm_classifier.py
250
3918
""" ================== 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
tbekolay/neurotools
neurotools/visualization/__init__.py
1
6758
import sys, os.path import numpy import tempfile, shutil import logging from neurotools import check_dependency from neurotools.plotting import progress_bar if check_dependency('matplotlib'): from matplotlib.figure import Figure from matplotlib.lines import Line2D from matplotlib.backends.backend_agg impor...
gpl-2.0
mbayon/TFG-MachineLearning
vbig/lib/python2.7/site-packages/sklearn/cluster/tests/test_k_means.py
7
32602
"""Testing for K-means""" import sys import numpy as np from scipy import sparse as sp from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import SkipTest from sklearn.utils.testing i...
mit
benoitsteiner/tensorflow-opencl
tensorflow/python/estimator/inputs/pandas_io_test.py
89
8340
# Copyright 2015 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
uwescience/pulse2percept
examples/models/plot_horsager2009.py
1
9470
# -*- coding: utf-8 -*- """ =============================================================================== Horsager et al. (2009): Predicting temporal sensitivity =============================================================================== This example shows how to use the :py:class:`~pulse2percept.models.Horsager...
bsd-3-clause
dssg/wikienergy
disaggregator/build/pandas/pandas/tests/test_msgpack/test_seq.py
6
1439
#!/usr/bin/env python # coding: utf-8 from pandas import compat from pandas.compat import u import pandas.msgpack as msgpack binarydata = [chr(i) for i in range(256)] binarydata = "".join(binarydata) if compat.PY3: binarydata = binarydata.encode('utf-8') def gen_binary_data(idx): data = binarydata[:idx % 300...
mit
toobaz/pandas
asv_bench/benchmarks/stat_ops.py
1
4452
import numpy as np import pandas as pd ops = ["mean", "sum", "median", "std", "skew", "kurt", "mad", "prod", "sem", "var"] class FrameOps: params = [ops, ["float", "int"], [0, 1], [True, False]] param_names = ["op", "dtype", "axis", "use_bottleneck"] def setup(self, op, dtype, axis, use_bottleneck): ...
bsd-3-clause
ericfourrier/decam
decam/feature_importance.py
1
5164
# -*- coding: utf-8 -*- """ @author: kevin olivier """ import pandas as pd import numpy as np from sklearn.feature_selection import SelectKBest, f_classif from sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifier class FeatureImportance: def __init__(self, df, resp): self.dataframe = df...
mit
terkkila/scikit-learn
sklearn/pipeline.py
162
21103
""" The :mod:`sklearn.pipeline` module implements utilities to build a composite estimator, as a chain of transforms and estimators. """ # Author: Edouard Duchesnay # Gael Varoquaux # Virgile Fritsch # Alexandre Gramfort # Lars Buitinck # Licence: BSD from collections import defaultdict...
bsd-3-clause
BuddyVolly/OpenSARKit
lib/python/ost_regressor.py
2
6757
#! /usr/bin/python # thanks to the great tutorial of Carlos de la Torre # http://www.machinalis.com/blog/python-for-geospatial-data-processing/ import numpy as np import os from osgeo import gdal, ogr, osr from sklearn import metrics from sklearn.ensemble import RandomForestRegressor # Tell GDAL to throw Python exce...
mit
MatthieuBizien/scikit-learn
examples/cross_decomposition/plot_compare_cross_decomposition.py
55
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
darioizzo/optimal_landing
indirect_method/falcon_landing.py
1
16719
""" Implements an indirect method to solve the optimal control problem of a varying mass spacecraft controlled by one thruster capable of vectoring. Dario Izzo 2016 """ from PyGMO.problem._base import base from numpy.linalg import norm from math import sqrt, sin, cos, atan2, pi from scipy.integrate import odeint f...
lgpl-3.0
Denisolt/Tensorflow_Chat_Bot
local/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/estimators/_sklearn.py
153
6723
# 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...
gpl-3.0
shikhardb/scikit-learn
sklearn/decomposition/pca.py
24
22932
""" Principal Component Analysis """ # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Olivier Grisel <olivier.grisel@ensta.org> # Mathieu Blondel <mathieu@mblondel.org> # Denis A. Engemann <d.engemann@fz-juelich.de> # Michael Eickenberg <michael.eickenberg@inria.fr> # # Lice...
bsd-3-clause
karstenw/nodebox-pyobjc
examples/Extended Application/sklearn/examples/ensemble/plot_voting_decision_regions.py
1
3238
""" ================================================== Plot the decision boundaries of a VotingClassifier ================================================== Plot the decision boundaries of a `VotingClassifier` for two features of the Iris dataset. Plot the class probabilities of the first sample in a toy dataset pred...
mit
DGrady/pandas
pandas/tests/io/msgpack/test_format.py
25
2882
# coding: utf-8 from pandas.io.msgpack import unpackb def check(src, should, use_list=0): assert unpackb(src, use_list=use_list) == should def testSimpleValue(): check(b"\x93\xc0\xc2\xc3", (None, False, True, )) def testFixnum(): check(b"\x92\x93\x00\x40\x7f\x93\xe0\xf0\xff", ((0, ...
bsd-3-clause
RayMick/scikit-learn
sklearn/externals/joblib/parallel.py
79
35628
""" Helpers for embarrassingly parallel code. """ # Author: Gael Varoquaux < gael dot varoquaux at normalesup dot org > # Copyright: 2010, Gael Varoquaux # License: BSD 3 clause from __future__ import division import os import sys import gc import warnings from math import sqrt import functools import time import thr...
bsd-3-clause
akionakamura/scikit-learn
examples/cluster/plot_agglomerative_clustering.py
343
2931
""" Agglomerative clustering with and without structure =================================================== This example shows the effect of imposing a connectivity graph to capture local structure in the data. The graph is simply the graph of 20 nearest neighbors. Two consequences of imposing a connectivity can be s...
bsd-3-clause
eg-zhang/h2o-2
py/testdir_single_jvm/test_GLM2_score_same.py
9
4631
## Dataset created from this: # # from sklearn.datasets import make_hastie_10_2 # import numpy as np # i = 1000000 # f = 10 # (X,y) = make_hastie_10_2(n_samples=i,random_state=None) # y.shape = (i,1) # Y = np.hstack((X,y)) # np.savetxt('./1mx' + str(f) + '_hastie_10_2.data', Y, delimiter=',', fmt='%.2f'); import unit...
apache-2.0
PedroTrujilloV/nest-simulator
pynest/nest/voltage_trace.py
12
6711
# -*- coding: utf-8 -*- # # voltage_trace.py # # This file is part of NEST. # # Copyright (C) 2004 The NEST Initiative # # NEST 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 2 of the License, ...
gpl-2.0
irisyuichan/news_topic_mining
news_topic_clustering.py
1
8205
""" ======================================= Clustering text documents using k-means ======================================= This is an example showing how the scikit-learn can be used to cluster documents by topics using a bag-of-words approach. This example uses a scipy.sparse matrix to store the features instead of ...
mit
iarroyof/distributionalSemanticStabilityThesis
mkl_regressor.py
2
9784
from modshogun import * from numpy import * from sklearn.metrics import r2_score from scipy.stats import randint from scipy import stats from scipy.stats import randint as sp_randint from scipy.stats import expon import sys, os import Gnuplot, Gnuplot.funcutils class mkl_regressor(): def __init__(self, widths = N...
gpl-2.0
H3rsh3/odm-py-templating
example/templp.py
2
3594
import pandas as pd import numpy as np import shutil import fileinput import sys import time import subprocess class Import_conf(): def __init__(self,i_data,i_base): self.i_data = i_data self.i_base = i_base def generate_ic(self): #--import config_data file config_data = pd.read_csv("{0}".format(self.i_da...
gpl-3.0
badbytes/pymeg
meg/get.py
1
1332
"""Return sensors and headshape positions""" from msiread import getposted from numpy import * pdf=getposted.read() hs=pdf.head_shape.hs_points m=pdf.GetSignalMEGDevices() x=[]; y=[]; z=[]; class headshape(): """hs=pos.headshape.hsm""" hsa=array(hs) hsm=zeros((size(hsa),3)) for i in range(len(hsa)): ...
gpl-3.0
dpshelio/sunpy
sunpy/map/sources/trace.py
2
3151
"""TRACE Map subclass definitions""" #pylint: disable=W0221,W0222,E1101,E1121 __author__ = "Jack Ireland" __email__ = "jack.ireland@nasa.gov" import matplotlib.pyplot as plt from astropy.visualization import LogStretch from astropy.visualization.mpl_normalize import ImageNormalize from sunpy.map import GenericMap fr...
bsd-2-clause
awalls-cx18/gnuradio
gr-filter/examples/reconstruction.py
7
5011
#!/usr/bin/env python # # Copyright 2010,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio 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, or (at your ...
gpl-3.0
RBDA-F17/crime
code_drop_2/filter_clean_crime.py
2
1179
import os import sys import pandas as pd from pyspark.sql.types import * from pyspark.sql import Row, Column from pyspark.sql.functions import * from datetime import datetime from pyspark import SparkConf, SparkContext from pyspark.sql import SQLContext from pyspark.sql.functions import udf user = os. environ['USER'] ...
gpl-3.0
robin-lai/scikit-learn
examples/linear_model/plot_sgd_comparison.py
77
1820
""" ================================== Comparing various online solvers ================================== An example showing how different online solvers perform on the hand-written digits dataset. """ # Author: Rob Zinkov <rob at zinkov dot com> # License: BSD 3 clause import numpy as np import matplotlib.pyplot a...
bsd-3-clause
metaml/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/offsetbox.py
69
17728
""" The OffsetBox is a simple container artist. The child artist are meant to be drawn at a relative position to its parent. The [VH]Packer, DrawingArea and TextArea are derived from the OffsetBox. The [VH]Packer automatically adjust the relative postisions of their children, which should be instances of the OffsetBo...
agpl-3.0
alexsavio/scikit-learn
examples/model_selection/plot_underfitting_overfitting.py
41
2672
""" ============================ Underfitting vs. Overfitting ============================ This example demonstrates the problems of underfitting and overfitting and how we can use linear regression with polynomial features to approximate nonlinear functions. The plot shows the function that we want to approximate, wh...
bsd-3-clause
hlin117/statsmodels
statsmodels/stats/power.py
31
47523
# -*- coding: utf-8 -*- #pylint: disable-msg=W0142 """Statistical power, solving for nobs, ... - trial version Created on Sat Jan 12 21:48:06 2013 Author: Josef Perktold Example roundtrip - root with respect to all variables calculated, desired nobs 33.367204205 33.367204205 effect 0.5 0.5 alpha 0.05 0.05...
bsd-3-clause
gibiansky/tensorflow
tensorflow/contrib/learn/python/learn/estimators/estimator_test.py
3
38410
# 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
maxplanck-ie/HiCExplorer
hicexplorer/hicCorrectMatrix.py
1
31877
import warnings import sys warnings.simplefilter(action="ignore", category=RuntimeWarning) warnings.simplefilter(action="ignore", category=PendingDeprecationWarning) import argparse from past.builtins import zip from scipy.sparse import lil_matrix from hicexplorer.iterativeCorrection import iterativeCorrection from hi...
gpl-2.0
marrcio/relate-kanji
resources/util/toolbox/graphictools.py
1
1873
import matplotlib.pyplot as plt from collections import Counter plt.ion() def visualize_bars(iterable, width=0.5, color='b', counter_feed=False, high_dpi=True, transformation=lambda x:x): if counter_feed: c = iterable else: c = Counter(iterable) if high_dpi: plt.figure(dpi=200) ...
mit
kou/arrow
python/pyarrow/tests/test_flight.py
3
68243
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
apache-2.0
schets/LILAC
src/scripts/python/learn-grad.py
2
3221
import numpy as np from sklearn import manifold, svm, preprocessing import pylab as pl from mpl_toolkits.mplot3d import Axes3D from matplotlib.ticker import NullFormatter Axes3D def read_data(gradname, scorename): #could use numpy.loadtxt, but that blindly accepts nan values slist = open(scorename, 'r').readlin...
bsd-3-clause
brockk/clintrials
clintrials/dosefinding/efftox.py
1
45709
__author__ = 'Kristian Brock' __contact__ = 'kristian.brock@gmail.com' """ An implementation of Thall & Cook's EffTox design for dose-finding in clinical trials. See: Thall, P.F. and Cook, J.D. (2004). Dose-Finding Based on Efficacy-Toxicity Trade-Offs, Biometrics, 60: 684-693. Cook, J.D. Efficacy-Toxicity trade-offs...
gpl-3.0
idontgetoutmuch/ParkingWestminster
load_SJWHS.py
1
2784
import pandas as pd from pandas import DataFrame, Series import numpy as np import os import csv names = ["amount paid", "paid duration mins", "start date", "start day", "end date", "end day", "start time", "end time", "DesignationType", "Hours of Control", "Tariff", "Max Stay", "Spaces", "Street", "x coordinate...
apache-2.0
NMGRL/pychron
pychron/mv/locator.py
2
28476
# Copyright 2012 Jake Ross # # 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, soft...
apache-2.0
e-koch/VLA_Lband
ancillary_data/HST/HI_properties_near_feedback.py
1
17038
''' Pull out HI properties (and/or others) from a set of point sources. Create a distance map as a function of distance from the nearest source. ''' import astropy.coordinates as coord from astropy.table import Table, Column import astropy.units as u import astropy.constants as const import numpy as np from galaxies...
mit
jrbadiabo/Coursera-Stanford-ML-Class
Python_Version/Ex1.Linear_Regresion_with_one_variable/ex1_multi.py
1
3757
from matplotlib import use use('TkAgg') import numpy as np import matplotlib.pyplot as plt from gradientDescentMulti import gradientDescentMulti from normalEqn import normalEqn from featureNormalize import featureNormalize from show import show # ================ Part 1: Feature Normalization ================ print '...
mit
ndingwall/scikit-learn
examples/ensemble/plot_gradient_boosting_regression.py
11
5041
""" ============================ Gradient Boosting regression ============================ This example demonstrates Gradient Boosting to produce a predictive model from an ensemble of weak predictive models. Gradient boosting can be used for regression and classification problems. Here, we will train a model to tackl...
bsd-3-clause
ycaihua/scikit-learn
sklearn/datasets/svmlight_format.py
39
15319
"""This module implements a loader and dumper for the svmlight format This format is a text-based format, with one sample per line. It does not store zero valued features hence is suitable for sparse dataset. The first element of each line can be used to store a target variable to predict. This format is used as the...
bsd-3-clause
sem-geologist/hyperspy
hyperspy/tests/mva/test_bss.py
2
13019
import pytest import numpy as np import numpy.testing as nt from hyperspy._signals.signal1d import Signal1D from hyperspy._signals.signal2d import Signal2D from hyperspy.misc.machine_learning.import_sklearn import sklearn_installed from hyperspy.datasets import artificial_data def are_bss_components_equivalent(c1_li...
gpl-3.0
PabloPiaggi/plumed2
user-doc/tutorials/others/ves-lugano2017-kinetics/TRAJECTORIES-1700K/cdf-analysis.py
6
1134
#!/usr/bin/env python import numpy as np from scipy.stats import ks_2samp from scipy.optimize import curve_fit from statsmodels.distributions.empirical_distribution import ECDF import matplotlib.pyplot as plt f=open('fpt.dat','r') # define theoretical CDF def func(x,tau): return 1-np.exp(-x/tau) x = [] count=0 ...
lgpl-3.0
jmargeta/scikit-learn
sklearn/tests/test_multiclass.py
3
12251
import numpy as np import warnings from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_false from sklearn.utils.testing import ass...
bsd-3-clause
HyukjinKwon/spark
python/pyspark/sql/dataframe.py
9
102339
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
apache-2.0
white-lab/pyproteome
pyproteome/pathways/photon_ptm.py
1
5508
from collections import OrderedDict import io import logging import requests import os import tarfile import uuid import pyproteome as pyp import brainrnaseq as brs import pandas as pd import numpy as np LOGGER = logging.getLogger('pathways.photon_ptm') try: from genemap.mappers import EnsemblMapper except Impo...
bsd-2-clause
SteVwonder/MusiGraph
musigraph.py
1
6030
import requests import json import argparse from hashlib import md5 import networkx as nx import pygraphviz as pgv import matplotlib.pyplot as plt API_ROOT = "http://ws.audioscrobbler.com/2.0/" class ConfigException(Exception): pass class APIException(Exception): pass def parse_config(config_path): with...
apache-2.0
Srisai85/scikit-learn
sklearn/calibration.py
137
18876
"""Calibration of predicted probabilities.""" # Author: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Balazs Kegl <balazs.kegl@gmail.com> # Jan Hendrik Metzen <jhm@informatik.uni-bremen.de> # Mathieu Blondel <mathieu@mblondel.org> # # License: BSD 3 clause from __future__ impo...
bsd-3-clause
bittremieux/ANN-SoLo
src/setup.py
1
3715
import codecs import os import setuptools import numpy as np try: import Cython.Distutils except ImportError: use_cython = False else: use_cython = True def read(rel_path): here = os.path.abspath(os.path.dirname(__file__)) # Intentionally *not* adding an encoding option to open, See: # htt...
apache-2.0
kevin-intel/scikit-learn
examples/miscellaneous/plot_display_object_visualization.py
17
3676
""" =================================== Visualizations with Display Objects =================================== .. currentmodule:: sklearn.metrics In this example, we will construct display objects, :class:`ConfusionMatrixDisplay`, :class:`RocCurveDisplay`, and :class:`PrecisionRecallDisplay` directly from their resp...
bsd-3-clause
Deepomatic/DIGITS
digits/dataset/generic/views.py
3
7099
# Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved. from __future__ import absolute_import import os # Find the best implementation available try: from cStringIO import StringIO except ImportError: from StringIO import StringIO import caffe_pb2 import flask import matplotlib as mpl import mat...
bsd-3-clause
russel1237/scikit-learn
examples/missing_values.py
233
3056
""" ====================================================== Imputing missing values before building an estimator ====================================================== This example shows that imputing the missing values can give better results than discarding the samples containing any missing value. Imputing does not ...
bsd-3-clause
herilalaina/scikit-learn
examples/linear_model/plot_sgd_comparison.py
29
1873
""" ================================== Comparing various online solvers ================================== An example showing how different online solvers perform on the hand-written digits dataset. """ # Author: Rob Zinkov <rob at zinkov dot com> # License: BSD 3 clause import numpy as np import matplotlib.pyplot a...
bsd-3-clause
nchammas/spark
python/pyspark/sql/pandas/utils.py
6
2633
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
apache-2.0
dmitriz/zipline
tests/pipeline/test_engine.py
3
26134
""" Tests for SimplePipelineEngine """ from __future__ import division from collections import OrderedDict from unittest import TestCase from itertools import product from numpy import ( array, full, nan, tile, zeros, float32, concatenate, ) from pandas import ( DataFrame, date_rang...
apache-2.0