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
rs2/pandas
pandas/tests/extension/test_integer.py
2
7327
""" This file contains a minimal set of tests for compliance with the extension array interface test suite, and should contain no other tests. The test suite for the full functionality of the array is located in `pandas/tests/arrays/`. The tests in this file are inherited from the BaseExtensionTests, and only minimal ...
bsd-3-clause
scienceopen/transcarread
plasma_state.py
1
1292
#!/usr/bin/env python """ Reads output of Transcar sim, yielding Incoherent Scatter Radar plasma parameters. python transcar2isr.py tests/data/beam52 """ from pathlib import Path from matplotlib.pyplot import show from argparse import ArgumentParser from datetime import datetime # import transcarread.plots as pl...
gpl-3.0
dingocuster/scikit-learn
sklearn/tests/test_learning_curve.py
225
10791
# Author: Alexander Fabisch <afabisch@informatik.uni-bremen.de> # # License: BSD 3 clause import sys from sklearn.externals.six.moves import cStringIO as StringIO import numpy as np import warnings from sklearn.base import BaseEstimator from sklearn.learning_curve import learning_curve, validation_curve from sklearn.u...
bsd-3-clause
aolindahl/polarization-monitor
offline_handler.py
1
9272
# -*- coding: utf-8 -*- """ Created on Wed May 27 12:59:34 2015 @author: antlin """ import h5py import numpy as np import sys import matplotlib.pyplot as plt from aolPyModules import cookie_box import lmfit photo_roi = [[236.5, 250], [236.5, 250], [242.0, 260], [242.0, 260], ...
gpl-2.0
jenfly/python-practice
maps/maps.py
1
2641
import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap from datetime import datetime # Globe with Orthographic projection # ---------------------------------- # lon_0, lat_0 are the center point of the projection. # resolution = 'l' means use low resolution coastlines. lon_0, lat_0...
mit
agoose77/hivesystem
manual/movingpanda/panda-13.py
1
9853
import dragonfly import dragonfly.pandahive import bee from bee import connect import dragonfly.scene.unbound, dragonfly.scene.bound import dragonfly.std import dragonfly.io import dragonfly.canvas import dragonfly.convert.pull import dragonfly.logic import dragonfly.bind import Spyder # ## random matrix generator f...
bsd-2-clause
TPeterW/Bitcoin-Price-Prediction
data_collection/flip_sheets.py
1
1705
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys import pandas as pd def main(): if len(sys.argv) >= 2: filenames = sys.argv[1:] for filename in filenames: flipfile(filename) # else: # files = ["Anoncoin.csv", "Argentum.csv", "BBQCoin.csv", "BetaCoin.csv", "BitB...
mit
cwu2011/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
dingocuster/scikit-learn
sklearn/semi_supervised/tests/test_label_propagation.py
307
1974
""" test the label propagation module """ import nose import numpy as np from sklearn.semi_supervised import label_propagation from numpy.testing import assert_array_almost_equal from numpy.testing import assert_array_equal ESTIMATORS = [ (label_propagation.LabelPropagation, {'kernel': 'rbf'}), (label_propa...
bsd-3-clause
jreback/pandas
pandas/tests/indexing/common.py
2
5245
""" common utilities """ import itertools import numpy as np from pandas import DataFrame, Float64Index, MultiIndex, Series, UInt64Index, date_range import pandas._testing as tm def _mklbl(prefix, n): return [f"{prefix}{i}" for i in range(n)] def _axify(obj, key, axis): # create a tuple accessor axes ...
bsd-3-clause
mwaskom/seaborn
seaborn/regression.py
2
39418
"""Plotting functions for linear models (broadly construed).""" import copy from textwrap import dedent import warnings import numpy as np import pandas as pd import matplotlib as mpl import matplotlib.pyplot as plt try: import statsmodels assert statsmodels _has_statsmodels = True except ImportError: ...
bsd-3-clause
JeanKossaifi/scikit-learn
sklearn/datasets/species_distributions.py
198
7923
""" ============================= Species distribution dataset ============================= This dataset represents the geographic distribution of species. The dataset is provided by Phillips et. al. (2006). The two species are: - `"Bradypus variegatus" <http://www.iucnredlist.org/apps/redlist/details/3038/0>`_...
bsd-3-clause
ronekko/spatial_transformer_network
main.py
1
8637
# -*- coding: utf-8 -*- """ Created on Mon Sep 14 21:17:12 2015 @author: sakurai """ import argparse import time import copy import numpy as np import matplotlib.pyplot as plt import chainer.functions as F from chainer import optimizers from chainer import Variable, FunctionSet from chainer import cuda import spatial...
mit
theonaun/surgeo
tests/app/test_cli.py
1
5819
import os import pathlib import subprocess import sys import tempfile import unittest import numpy as np import pandas as pd import surgeo.app.surgeo_cli class TestSurgeoCLI(unittest.TestCase): _CLI_SCRIPT = surgeo.app.surgeo_cli.__file__ _DATA_FOLDER = pathlib.Path(__file__).resolve().parents[1] / 'data'...
mit
lneuhaus/pyrpl
pyrpl/software_modules/spectrum_analyzer.py
1
29677
############################################################################### # pyrpl - DSP servo controller for quantum optics with the RedPitaya # Copyright (C) 2014-2016 Leonhard Neuhaus (neuhaus@spectro.jussieu.fr) # # This program is free software: you can redistribute it and/or modify # it under t...
gpl-3.0
nicococo/ClusterSvdd
scripts/test_ad_svdd.py
1
7209
import matplotlib.pyplot as plt import sklearn.metrics as metrics import sklearn.datasets as datasets import numpy as np from ClusterSVDD.svdd_primal_sgd import SvddPrimalSGD from ClusterSVDD.svdd_dual_qp import SvddDualQP from ClusterSVDD.cluster_svdd import ClusterSvdd def generate_data_uniform(datapoints, cluster...
mit
michrawson/nyu_ml_lectures
notebooks/figures/plot_rbf_svm_parameters.py
19
2018
import matplotlib.pyplot as plt import numpy as np from sklearn.svm import SVC from sklearn.datasets import make_blobs from .plot_2d_separator import plot_2d_separator def make_handcrafted_dataset(): # a carefully hand-designed dataset lol X, y = make_blobs(centers=2, random_state=4, n_samples=30) y[np.ar...
cc0-1.0
wzbozon/statsmodels
statsmodels/sandbox/examples/try_multiols.py
33
1243
# -*- coding: utf-8 -*- """ Created on Sun May 26 13:23:40 2013 Author: Josef Perktold, based on Enrico Giampieri's multiOLS """ #import numpy as np import pandas as pd import statsmodels.api as sm from statsmodels.sandbox.multilinear import multiOLS, multigroup data = sm.datasets.longley.load_pandas() df = data.e...
bsd-3-clause
yanboliang/spark
python/pyspark/sql/types.py
2
67075
# # 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
scottpurdy/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/dates.py
15
33969
""" Matplotlib provides sophisticated date plotting capabilities, standing on the shoulders of python :mod:`datetime`, the add-on modules :mod:`pytz` and :mod:`dateutils`. :class:`datetime` objects are converted to floating point numbers which represent the number of days since 0001-01-01 UTC. The helper functions :f...
agpl-3.0
xwolf12/scikit-learn
sklearn/ensemble/tests/test_bagging.py
127
25365
""" Testing for the bagging ensemble module (sklearn.ensemble.bagging). """ # Author: Gilles Louppe # License: BSD 3 clause import numpy as np from sklearn.base import BaseEstimator from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.te...
bsd-3-clause
jimsrc/seatos
mixed.icmes/src/report/tt2a.py
1
11159
#!/usr/bin/env ipython from pylab import * import numpy as np from scipy.io.netcdf import netcdf_file import os, sys import matplotlib.patches as patches import matplotlib.transforms as transforms from numpy import array from matplotlib.gridspec import GridSpec import matplotlib.pyplot as plt from os.path import isdir,...
mit
andrewnc/scikit-learn
sklearn/ensemble/partial_dependence.py
251
15097
"""Partial dependence plots for tree ensembles. """ # Authors: Peter Prettenhofer # License: BSD 3 clause from itertools import count import numbers import numpy as np from scipy.stats.mstats import mquantiles from ..utils.extmath import cartesian from ..externals.joblib import Parallel, delayed from ..externals im...
bsd-3-clause
bert9bert/statsmodels
statsmodels/stats/mediation.py
4
16140
""" Mediation analysis Implements algorithm 1 ('parametric inference') and algorithm 2 ('nonparametric inference') from: Imai, Keele, Tingley (2010). A general approach to causal mediation analysis. Psychological Methods 15:4, 309-334. http://imai.princeton.edu/research/files/BaronKenny.pdf The algorithms are desc...
bsd-3-clause
gengliangwang/spark
python/pyspark/pandas/missing/__init__.py
16
1907
# # 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
artem279/cbrf
cbrWebService/analytics.py
1
27529
import numpy as np from pandas import DataFrame, Series import pandas as pd import matplotlib.pyplot as plt import seaborn as s import json from . import cbrWebService # cbr = cbrWebService.CreditOrgInfo() class Metrics: def __init__(self): self.__cbr = cbrWebService.CreditOrgInfo() self.__banks...
mit
chuajiesheng/twitter-sentiment-analysis
step_4/scripts/train_sentiment_model.py
1
6222
import numpy as np import nltk import sklearn import tokenizers import multiprocessing import itertools import functools import pandas as pd import scipy import os import shlex INPUT_FILE = './step_4/input/sentiment.xlsx' CV = 10 TRAIN_SIZE = 0.8 RANDOM_SEED = 42 K_BEST = 100 SAMPLE_SIZE = 1500 dataset = pd.read_excel...
apache-2.0
paurichardson/trading-with-python
lib/extra.py
77
2540
''' Created on Apr 28, 2013 Copyright: Jev Kuznetsov License: BSD ''' from __future__ import print_function import sys import urllib import os import xlrd # module for excel file reading import pandas as pd class ProgressBar: def __init__(self, iterations): self.iterations = iterations ...
bsd-3-clause
pgandhi999/spark
python/pyspark/sql/functions.py
1
143545
# # 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
MiniPlayer/log-island
logisland-plugins/logisland-scripting-processors-plugin/src/main/resources/nltk/draw/dispersion.py
7
1744
# Natural Language Toolkit: Dispersion Plots # # Copyright (C) 2001-2016 NLTK Project # Author: Steven Bird <stevenbird1@gmail.com> # URL: <http://nltk.org/> # For license information, see LICENSE.TXT """ A utility for displaying lexical dispersion. """ def dispersion_plot(text, words, ignore_case=False, title="Lexic...
apache-2.0
derDavidT/sympy
sympy/physics/quantum/state.py
58
29186
"""Dirac notation for states.""" from __future__ import print_function, division from sympy import (cacheit, conjugate, Expr, Function, integrate, oo, sqrt, Tuple) from sympy.core.compatibility import u, range from sympy.printing.pretty.stringpict import stringPict from sympy.physics.quantum.qexpr ...
bsd-3-clause
grandtiger/trading-with-python
lib/functions.py
76
11627
# -*- coding: utf-8 -*- """ twp support functions @author: Jev Kuznetsov Licence: GPL v2 """ from scipy import polyfit, polyval import datetime as dt #from datetime import datetime, date from pandas import DataFrame, Index, Series import csv import matplotlib.pyplot as plt import numpy as np import p...
bsd-3-clause
sthenc/nc_packer
tools/htk_mfcc_visualize.py
1
5379
#!/usr/bin/python import numpy as np import matplotlib as ml import matplotlib.pyplot as plt import htkmfc as hm import argparse parser = argparse.ArgumentParser() parser.add_argument("filename", help="Input mfcc.htk file") parser.add_argument("-on", "--output-norm", help="Normalize using output mean and stddev val...
mit
tkaitchuck/nupic
external/linux64/lib/python2.6/site-packages/matplotlib/cm.py
70
5385
""" This module contains the instantiations of color mapping classes """ import numpy as np from numpy import ma import matplotlib as mpl import matplotlib.colors as colors import matplotlib.cbook as cbook from matplotlib._cm import * def get_cmap(name=None, lut=None): """ Get a colormap instance, defaultin...
gpl-3.0
crichardson17/starburst_atlas
Low_resolution_sims/Dusty_LowRes/Geneva_inst_Rot/Geneva_inst_Rot_0/fullgrid/UV2.py
31
9339
import csv import matplotlib.pyplot as plt from numpy import * import scipy.interpolate import math from pylab import * from matplotlib.ticker import MultipleLocator, FormatStrFormatter import matplotlib.patches as patches from matplotlib.path import Path import os # --------------------------------------------------...
gpl-2.0
Erotemic/ubelt
tests/test_progiter.py
1
14480
# -*- coding: utf-8 -*- """ pytest ubelt/tests/test_progiter.py """ from six.moves import cStringIO from xdoctest.utils import strip_ansi from ubelt.progiter import ProgIter import sys def test_rate_format_string(): # Less of a test than a demo rates = [1 * 10 ** i for i in range(-10, 10)] texts = [] ...
apache-2.0
yonglehou/scikit-learn
sklearn/metrics/tests/test_score_objects.py
138
14048
import pickle import numpy as np from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_raises from sklearn.utils.testing import assert_raises_regexp from sklearn.utils.testing import assert_true from sklearn.utils.testing im...
bsd-3-clause
espenhgn/nest-simulator
pynest/examples/gap_junctions_inhibitory_network.py
5
5989
# -*- coding: utf-8 -*- # # gap_junctions_inhibitory_network.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...
gpl-2.0
ellipsis14/dolfin-adjoint
tests_dolfin/ode_solver/ode_solver.py
1
3453
try: from dolfin import BackwardEuler except ImportError: from dolfin import info_red info_red("Need dolfin > 1.2.0 for ode_solver test.") import sys; sys.exit(0) from dolfin import * from dolfin_adjoint import * import ufl.algorithms if not hasattr(MultiStageScheme, "to_tlm"): info_red("Need dolfin > 1.2.0...
lgpl-3.0
davidgbe/scikit-learn
examples/model_selection/plot_train_error_vs_test_error.py
349
2577
""" ========================= Train error vs Test error ========================= Illustration of how the performance of an estimator on unseen data (test data) is not the same as the performance on training data. As the regularization increases the performance on train decreases while the performance on test is optim...
bsd-3-clause
obreitwi/nest-simulator
pynest/examples/plot_weight_matrices.py
17
6243
# -*- coding: utf-8 -*- # # plot_weight_matrices.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 Li...
gpl-2.0
nikitasingh981/scikit-learn
examples/applications/plot_model_complexity_influence.py
323
6372
""" ========================== Model Complexity Influence ========================== Demonstrate how model complexity influences both prediction accuracy and computational performance. The dataset is the Boston Housing dataset (resp. 20 Newsgroups) for regression (resp. classification). For each class of models we m...
bsd-3-clause
Git3251/trading-with-python
cookbook/getDataFromYahooFinance.py
77
1391
# -*- coding: utf-8 -*- """ Created on Sun Oct 16 18:37:23 2011 @author: jev """ from urllib import urlretrieve from urllib2 import urlopen from pandas import Index, DataFrame from datetime import datetime import matplotlib.pyplot as plt sDate = (2005,1,1) eDate = (2011,10,1) symbol = 'SPY' fNa...
bsd-3-clause
krousey/test-infra
queue_health/graph/graph.py
5
16021
#!/usr/bin/env python # Copyright 2016 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 appli...
apache-2.0
mikeheddes/Intersection-Control
traffic_time.py
1
3580
# System import re import time # Third party import traci from traci import trafficlights as tratl from traci import vehicle as trave import numpy as np import pandas as pd import matplotlib import matplotlib.pyplot as plt class TrafficTime(): def setTimeTillGreen(self): for laneID, time in self.timeTillG...
apache-2.0
fjxhkj/PTVS
Python/Product/ML/ProjectTemplates/ClusteringTemplate/clustering.py
18
10394
''' This script perfoms the basic process for applying a machine learning algorithm to a dataset using Python libraries. The four steps are: 1. Download a dataset (using pandas) 2. Process the numeric data (using numpy) 3. Train and evaluate learners (using scikit-learn) 4. Plot and compare results...
apache-2.0
macruz21/trading-with-python
historicDataDownloader/historicDataDownloader.py
77
4526
''' Created on 4 aug. 2012 Copyright: Jev Kuznetsov License: BSD a module for downloading historic data from IB ''' import ib import pandas from ib.ext.Contract import Contract from ib.opt import ibConnection, message from time import sleep import tradingWithPython.lib.logger as logger from pandas impor...
bsd-3-clause
toobaz/pandas
pandas/tests/io/parser/test_converters.py
2
3993
""" Tests column conversion functionality during parsing for all of the parsers defined in parsers.py """ from io import StringIO from dateutil.parser import parse import numpy as np import pytest import pandas as pd from pandas import DataFrame, Index import pandas.util.testing as tm def test_converters_type_must_...
bsd-3-clause
alshedivat/tensorflow
tensorflow/contrib/learn/python/learn/estimators/__init__.py
39
12688
# 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
jdavidrcamacho/Tests_GP
MSc_results/speed_test7.py
2
13319
# -*- coding: utf-8 -*- import Gedi as gedi import george import numpy as np; np.random.seed(17654) import matplotlib.pylab as pl; pl.close('all') from time import time,sleep import emcee import sys ##### INITIAL DATA ########################################################### burns, runs = 1000, 2000 nrep = 5 pontos=...
mit
jeffshek/betterself
analytics/events/tests/test_analytics.py
1
5714
import datetime import pandas as pd from django.test import TestCase # python manage.py test analytics.events.tests.test_analytics from analytics.events.analytics import DataFrameEventsAnalyzer class DataFrameEventsAnalyzerTests(TestCase): PRODUCTIVITY_COLUMN = 'Productivity' NEGATIVE_PRODUCTIVITY_COLUMN = ...
mit
raghavrv/scikit-learn
examples/cluster/plot_kmeans_silhouette_analysis.py
26
5953
""" =============================================================================== Selecting the number of clusters with silhouette analysis on KMeans clustering =============================================================================== Silhouette analysis can be used to study the separation distance between the...
bsd-3-clause
Curious72/sympy
examples/intermediate/mplot3d.py
93
1252
#!/usr/bin/env python """Matplotlib 3D plotting example Demonstrates plotting with matplotlib. """ import sys from sample import sample from sympy import sin, Symbol from sympy.external import import_module def mplot3d(f, var1, var2, show=True): """ Plot a 3d function using matplotlib/Tk. """ im...
bsd-3-clause
tyarkoni/featureX
pliers/extractors/text.py
1
36443
''' Extractors that operate primarily or exclusively on Text stimuli. ''' import sys import itertools import logging import numpy as np import pandas as pd import scipy import nltk from nltk.sentiment.vader import SentimentIntensityAnalyzer from pliers.stimuli.text import TextStim, ComplexTextStim from pliers.extract...
bsd-3-clause
pravsripad/mne-python
mne/cov.py
4
79476
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Matti Hämäläinen <msh@nmr.mgh.harvard.edu> # Denis A. Engemann <denis.engemann@gmail.com> # # License: BSD (3-clause) from copy import deepcopy from distutils.version import LooseVersion import itertools as itt from math import log import ...
bsd-3-clause
BiaDarkia/scikit-learn
sklearn/feature_selection/tests/test_feature_select.py
21
26665
""" Todo: cross-check the F-value with stats model """ from __future__ import division import itertools import warnings import numpy as np from scipy import stats, sparse from numpy.testing import run_module_suite from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from...
bsd-3-clause
Barmaley-exe/scikit-learn
examples/svm/plot_rbf_parameters.py
35
8096
''' ================== RBF SVM parameters ================== This example illustrates the effect of the parameters ``gamma`` and ``C`` of the Radius Basis Function (RBF) kernel SVM. Intuitively, the ``gamma`` parameter defines how far the influence of a single training example reaches, with low values meaning 'far' a...
bsd-3-clause
codevlabs/pandashells
pandashells/test/p_regress_tests.py
7
3090
#! /usr/bin/env python import sys import re from mock import patch, MagicMock from unittest import TestCase import numpy as np import pandas as pd from pandashells.bin.p_regress import main class MainTests(TestCase): @patch( 'pandashells.bin.p_regress.sys.argv', 'p.regress -m y~x'.split()) @p...
bsd-2-clause
wlamond/scikit-learn
examples/linear_model/plot_lasso_model_selection.py
39
5425
""" =================================================== Lasso model selection: Cross-Validation / AIC / BIC =================================================== Use the Akaike information criterion (AIC), the Bayes Information criterion (BIC) and cross-validation to select an optimal value of the regularization paramet...
bsd-3-clause
facemelters/data-science
Atlas/test-youtube2.py
1
5639
#!/usr/bin/python from datetime import datetime, timedelta import httplib2 import os import sys import pandas as pd from pprint import pprint as pp from apiclient.discovery import build from apiclient.errors import HttpError from oauth2client.client import flow_from_clientsecrets from oauth2client.file import Storage...
gpl-2.0
keit0222/force-plate-analizer
openForce/force_analyzer.py
1
14375
# coding: utf-8 import numpy as np # Libraries necessary for visualizing import seaborn as sns import matplotlib import matplotlib.pyplot as plt import matplotlib.cm as cm import warnings from scipy.signal import argrelmax,argrelmin import matplotlib.font_manager as fm import copy from data_reader import DataRea...
mit
yuyakanemoto/neural-style-loss
neural_style_loss_multi.py
1
3697
import os import scipy.misc import pandas as pd from argparse import ArgumentParser import time from neural_style_loss import styleloss, imread # default arguments OUTPUT = 'output.csv' LAYER_WEIGHT_EXP = 1 VGG_PATH = 'imagenet-vgg-verydeep-19.mat' POOLING = 'max' NORMALIZE = 1 VERBOSE = 1 TIMEIT = 1 def build_parse...
mit
ccasotto/rmtk
tests/vulnerability/tests_TO_BE_CHANGED/NSP/fragility_process/test_fragility.py
4
1770
# -*- coding: utf-8 -*- """ Created on Fri Jan 23 11:24:59 2015 @author: chiaracasotto """ # Clear existing variables def clearall(): all = [var for var in globals() if var[0] != "_"] for var in all: del globals()[var] clearall() # Import functions import matplotlib.pyplot as plt import numpy as np i...
agpl-3.0
rhiever/tpot
tests/feature_transformers_tests.py
3
2511
from sklearn.datasets import load_iris from tpot.builtins import CategoricalSelector, ContinuousSelector from nose.tools import assert_equal, assert_raises iris_data = load_iris().data def test_CategoricalSelector(): """Assert that CategoricalSelector works as expected.""" cs = CategoricalSelector() X_tra...
lgpl-3.0
mhallett/MeDaReDa
demos/demo1/plotccys.py
1
2727
# plot10ccy.py ''' Plot the ccy rates, and the product ''' import pandas as pd import matplotlib.pyplot as plt import matplotlib.animation as animation import datetime import medareda_lib def get_conn(): return medareda_lib.get_conn() # select count from vPrice connpg = get_conn() curpg = connpg.cursor() cu...
mit
xzh86/scikit-learn
sklearn/cross_decomposition/pls_.py
187
28507
""" The :mod:`sklearn.pls` module implements Partial Least Squares (PLS). """ # Author: Edouard Duchesnay <edouard.duchesnay@cea.fr> # License: BSD 3 clause from ..base import BaseEstimator, RegressorMixin, TransformerMixin from ..utils import check_array, check_consistent_length from ..externals import six import w...
bsd-3-clause
aleksandr-bakanov/astropy
astropy/modeling/functional_models.py
3
79385
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Mathematical models.""" import numpy as np from astropy import units as u from astropy.units import Quantity, UnitsError from astropy.utils.decorators import deprecated from .core import (Fittable1DModel, Fittable2DModel, ModelDefi...
bsd-3-clause
fibbo/DIRAC
Core/Utilities/Graphs/CurveGraph.py
10
5056
######################################################################## # $HeadURL$ ######################################################################## """ CurveGraph represents simple line graphs with markers. The DIRAC Graphs package is derived from the GraphTool plotting package of the CMS/Phedex...
gpl-3.0
zihua/scikit-learn
sklearn/decomposition/tests/test_dict_learning.py
46
9267
import numpy as np from sklearn.exceptions import ConvergenceWarning from sklearn.utils import check_array from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_true from...
bsd-3-clause
CoderHam/Machine_Learning_Projects
outliers/outlier_removal_regression.py
1
2724
#!/usr/bin/python import random import numpy import matplotlib.pyplot as plt import pickle from time import time from outlier_cleaner import outlierCleaner ### some data with outliers in it ages = pickle.load( open("practice_outliers_ages.pkl", "r") ) net_worths = pickle.load( open("practice_outliers_net_worths.pkl"...
gpl-2.0
cython-testbed/pandas
pandas/core/groupby/base.py
1
5184
""" Provide basic components for groupby. These defintiions hold the whitelist of methods that are exposed on the SeriesGroupBy and the DataFrameGroupBy objects. """ import types from pandas.util._decorators import make_signature from pandas.core.dtypes.common import is_scalar, is_list_like class GroupByMixin(object...
bsd-3-clause
LiZoRN/lizorn.github.io
talks/python-workshop/code/txt/PacificRimSpider.py
3
42651
# _*_ coding: utf-8 _*_ __author__ = 'lizorn' __date__ = '2018/4/5 19:56' from urllib import request from urllib.error import URLError, HTTPError from bs4 import BeautifulSoup as bs import re import jieba # 分词包 import pandas as pd import numpy #numpy计算包 import matplotlib.pyplot as plt import matplotlib from wordcl...
mit
redreamality/learning-to-rank
lerot/comparison/test/evaluateData.py
2
7948
''' Created on 15 jan. 2015 @author: Jos ''' from datetime import datetime import os import matplotlib.pyplot as plt import numpy as np params = { #'text.latex.preamble': r"\usepackage{lmodern}", #'text.usetex' : True, #'font.size' : 11, #'font.family' : 'lmodern', #'text.latex.unicode': True, } plt.rcParams.update(...
gpl-3.0
cmry/simple-queries
sec3_data.py
1
22791
"""Scripts to run the Data Collection part of the paper.""" import json from misc_keys import twitter_keys import pandas as pd from time import localtime from time import sleep from time import strftime import tweepy def log(message): """Print simple timestamped message log.""" entry = "{0} - {1}".format(str...
mit
ltiao/networkx
examples/multigraph/chess_masters.py
54
5146
#!/usr/bin/env python """ An example of the MultiDiGraph clas The function chess_pgn_graph reads a collection of chess matches stored in the specified PGN file (PGN ="Portable Game Notation") Here the (compressed) default file --- chess_masters_WCC.pgn.bz2 --- contains all 685 World Chess Championship matches from...
bsd-3-clause
chen0031/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
westurner/house_prices
house_prices/analysis.py
1
5123
#!/usr/bin/env python """ | Src: https://rhiever.github.io/tpot/examples/Boston_Example/ | Src: https://github.com/rhiever/tpot/blob/master/docs/sources/examples/Boston_Example.md | License: GPLv3 https://github.com/rhiever/tpot/blob/master/LICENSE """ import json import logging import os import os.path from collecti...
bsd-3-clause
henrykironde/scikit-learn
sklearn/neighbors/tests/test_ball_tree.py
129
10192
import pickle import numpy as np from numpy.testing import assert_array_almost_equal from sklearn.neighbors.ball_tree import (BallTree, NeighborsHeap, simultaneous_sort, kernel_norm, nodeheap_sort, DTYPE, ITYPE) from sklearn.neighbors.dis...
bsd-3-clause
mne-tools/mne-tools.github.io
0.22/_downloads/85d0b2d795ffd9861aeed8a9b6c1ffdc/plot_dipole_fit.py
12
4835
# -*- coding: utf-8 -*- """ ============================================================ Source localization with equivalent current dipole (ECD) fit ============================================================ This shows how to fit a dipole :footcite:`Sarvas1987` using mne-python. For a comparison of fits between MN...
bsd-3-clause
kjung/scikit-learn
examples/svm/plot_rbf_parameters.py
44
8096
''' ================== RBF SVM parameters ================== This example illustrates the effect of the parameters ``gamma`` and ``C`` of the Radial Basis Function (RBF) kernel SVM. Intuitively, the ``gamma`` parameter defines how far the influence of a single training example reaches, with low values meaning 'far' a...
bsd-3-clause
ssaeger/scikit-learn
sklearn/ensemble/__init__.py
153
1382
""" The :mod:`sklearn.ensemble` module includes ensemble-based methods for classification, regression and anomaly detection. """ from .base import BaseEnsemble from .forest import RandomForestClassifier from .forest import RandomForestRegressor from .forest import RandomTreesEmbedding from .forest import ExtraTreesCla...
bsd-3-clause
abigailStev/stingray
stingray/crossspectrum.py
1
34738
from __future__ import division, absolute_import, print_function import numpy as np import scipy import scipy.stats import scipy.fftpack import scipy.optimize from stingray.lightcurve import Lightcurve from stingray.utils import rebin_data, simon, rebin_data_log from stingray.exceptions import StingrayError from stin...
mit
ashhher3/scikit-learn
sklearn/neighbors/tests/test_nearest_centroid.py
21
4207
""" Testing for the nearest centroid module. """ import numpy as np from scipy import sparse as sp from numpy.testing import assert_array_equal from numpy.testing import assert_equal from sklearn.neighbors import NearestCentroid from sklearn import datasets from sklearn.metrics.pairwise import pairwise_distances # t...
bsd-3-clause
khkaminska/scikit-learn
sklearn/manifold/tests/test_spectral_embedding.py
216
8091
from nose.tools import assert_true from nose.tools import assert_equal from scipy.sparse import csr_matrix from scipy.sparse import csc_matrix import numpy as np from numpy.testing import assert_array_almost_equal, assert_array_equal from nose.tools import assert_raises from nose.plugins.skip import SkipTest from sk...
bsd-3-clause
mbayon/TFG-MachineLearning
venv/lib/python3.6/site-packages/pandas/tests/frame/test_indexing.py
7
104529
# -*- coding: utf-8 -*- from __future__ import print_function from warnings import catch_warnings from datetime import datetime, date, timedelta, time from pandas.compat import map, zip, range, lrange, lzip, long from pandas import compat from numpy import nan from numpy.random import randn import pytest import nu...
mit
aemerick/galaxy_analysis
grackle/cooling_cell_test.py
1
10203
import matplotlib.pyplot as plt import os import numpy as np import yt from pygrackle import \ FluidContainer, \ chemistry_data, \ evolve_constant_density from pygrackle.utilities.physical_constants import \ mass_hydrogen_cgs, \ sec_per_Myr, \ cm_per_mpc import sys from multiprocessing impor...
mit
georgetown-analytics/skidmarks
bin/AggressiveTurn.py
1
3643
# -*- coding: utf-8 -*- ############################################################################### # Information ############################################################################### # Created by Linwood Creekmore # Input by Vikkram Mittal # In partial fulfillment of the requirements for the Georget...
mit
JsNoNo/scikit-learn
sklearn/linear_model/setup.py
146
1713
import os from os.path import join import numpy from sklearn._build_utils import get_blas_info def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('linear_model', parent_package, top_path) cblas_libs, blas_info = get_blas_info...
bsd-3-clause
nkundiushuti/pydata2017bcn
dataset.py
1
7589
""" This file is based on DeepConvSep. Copyright (c) 2014-2017 Marius Miron <miron.marius at gmail.com> DeepConvSep 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 Li...
gpl-3.0
SuLab/RASLseqAligner
src/RASLseqAnalysis_NAR.py
1
21108
# Libraries import pandas as pd import editdist import mmap import os import sys import time import itertools import gzip import numpy as np from collections import Counter import random # ALIGNER BLAST def rasl_probe_blast(read_file_path, blastn_path, db_path): """ This function returns blast results ...
mit
nelson-liu/scikit-learn
examples/ensemble/plot_random_forest_embedding.py
47
3599
""" ========================================================= Hashing feature transformation using Totally Random Trees ========================================================= RandomTreesEmbedding provides a way to map data to a very high-dimensional, sparse representation, which might be beneficial for classificati...
bsd-3-clause
ndingwall/scikit-learn
sklearn/linear_model/_ransac.py
9
19646
# coding: utf-8 # Author: Johannes Schönberger # # License: BSD 3 clause import numpy as np import warnings from ..base import BaseEstimator, MetaEstimatorMixin, RegressorMixin, clone from ..base import MultiOutputMixin from ..utils import check_random_state, check_consistent_length from ..utils.random import sample...
bsd-3-clause
rahuldhote/scikit-learn
examples/linear_model/plot_sgd_penalties.py
249
1563
""" ============== SGD: Penalties ============== Plot the contours of the three penalties. All of the above are supported by :class:`sklearn.linear_model.stochastic_gradient`. """ from __future__ import division print(__doc__) import numpy as np import matplotlib.pyplot as plt def l1(xs): return np.array([np....
bsd-3-clause
kn45/ClickBaits
Split.py
1
1192
#!/usr/bin/env python import cPickle import logging import numpy as np import os import sys from sklearn.cross_validation import StratifiedKFold logging.basicConfig(level=logging.INFO, format="[%(levelname)s]: %(message)s") # data_file = 'data_raw/data_cln' # train_file = 'data_train/data_train' # valid_file = 'data...
mit
Michal-Fularz/decision_tree
tests/histogram_calculations.py
2
1270
import numpy as np import skimage import matplotlib.pyplot as plt import sklearn.preprocessing # this is a test function for checking different ways of calculating the histogram def calculate_histogram(image, number_of_bins): # different ways to calculate histogram histogram_from_np, bins_from_np = np.histogr...
mit
CORE-GATECH-GROUP/serpent-tools
serpentTools/utils/plot.py
1
9218
""" Utilties for assisting with plots """ from matplotlib import pyplot from matplotlib.axes import Axes from matplotlib.colors import Normalize, LogNorm from serpentTools.messages import warning from serpentTools.utils.docstrings import magicPlotDocDecorator __all__ = [ 'DETECTOR_PLOT_LABELS', 'DEPLETION_PL...
mit
krez13/scikit-learn
sklearn/gaussian_process/gaussian_process.py
17
34896
# -*- coding: utf-8 -*- # Author: Vincent Dubourg <vincent.dubourg@gmail.com> # (mostly translation, see implementation details) # Licence: BSD 3 clause from __future__ import print_function import numpy as np from scipy import linalg, optimize from ..base import BaseEstimator, RegressorMixin from ..metrics...
bsd-3-clause
jreback/pandas
pandas/core/missing.py
1
24498
""" Routines for filling missing data. """ from functools import partial from typing import TYPE_CHECKING, Any, List, Optional, Set, Union import numpy as np from pandas._libs import algos, lib from pandas._typing import ArrayLike, Axis, DtypeObj from pandas.compat._optional import import_optional_dependency from pa...
bsd-3-clause
mnwhite/HARK
ConsumptionSaving/Demos/NonDurables_During_Great_Recession.py
1
11290
""" At the onset of the Great Recession, there was a large drop (6.32%, according to FRED) in consumer spending on non-durables. Some economists have proffered that this could be attributed to precautionary motives-- a perceived increase in household income uncertainty induces more saving (less consumption) to prote...
apache-2.0
google/prediction_framework
cfs/prepare_transactions/main.py
1
12907
# Copyright 2020 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, soft...
apache-2.0