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
draperjames/qtpandas
setup.py
1
4056
# from __future__ import unicode_literals # from __future__ import print_function # from __future__ import division # from __future__ import absolute_import # # from builtins import open # from future import standard_library # standard_library.install_aliases() from setuptools import setup, find_packages from setuptoo...
mit
shyamalschandra/scikit-learn
examples/missing_values.py
71
3055
""" ====================================================== 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
timsf/bayeslib
testing/mix.py
1
1601
import pdb import importlib import pandas as pd import numpy as np import matplotlib.pyplot as plt from bayeslib.backends.blocked_gibbs import normal_mixture as mixn, multinomial_mixture as mixm import bayeslib.api_batch.mixtures as mix plt.ion() ## test normal mixture on artificial dataset nobs, ncomp, nvar = 100, 2...
gpl-3.0
kenshay/ImageScript
ProgramData/SystemFiles/Python/Lib/site-packages/matplotlib/backends/tkagg.py
10
1250
from __future__ import (absolute_import, division, print_function, unicode_literals) import six from six.moves import tkinter as Tk import numpy as np from matplotlib.backends import _tkagg def blit(photoimage, aggimage, bbox=None, colormode=1): tk = photoimage.tk if bbox is not Non...
gpl-3.0
pxsdirac/tushare
tushare/datayes/equity.py
17
6857
# -*- coding:utf-8 -*- """ 通联数据 Created on 2015/08/24 @author: Jimmy Liu @group : waditu @contact: jimmysoa@sina.cn """ from pandas.compat import StringIO import pandas as pd from tushare.util import vars as vs from tushare.util.common import Client from tushare.util import upass as up class Equity(): def _...
bsd-3-clause
pypot/scikit-learn
sklearn/tests/test_multiclass.py
72
24581
import numpy as np import scipy.sparse as sp 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 ...
bsd-3-clause
amolkahat/pandas
pandas/tests/test_algos.py
2
71102
# -*- coding: utf-8 -*- import numpy as np import pytest from numpy.random import RandomState from numpy import nan from datetime import datetime from itertools import permutations import struct from pandas import (Series, Categorical, CategoricalIndex, Timestamp, DatetimeIndex, Index, IntervalInd...
bsd-3-clause
klocey/ScalingMicroBiodiversity
fig-scripts/AppFigs/Fig1_Variants/DataSetComparison.py
2
3727
from __future__ import division import os import sys import matplotlib.pyplot as plt from matplotlib.pyplot import setp mydir = os.path.expanduser("~/GitHub/MicrobialScaling/") # function for setting the colors of the box plots pairs def setBoxColors(bp): #print len(bp['caps']) #print bp['fliers'][0] #pr...
gpl-3.0
facom/AstrodynTools
tides/potential-contours.py
1
1071
#!/usr/bin/env python #-*-coding:utf-8-*- from constants import * from numpy import * from matplotlib.pyplot import * ################################################### #UTILITIES ################################################### DEG=pi/180 RAD=180/pi def P2(psi): p=0.5*(3*cos(psi)**2-1) return p #########...
gpl-2.0
boomsbloom/dtm-fmri
DTM/for_gensim/lib/python2.7/site-packages/pandas/util/print_versions.py
7
4898
import os import platform import sys import struct import subprocess import codecs import locale import importlib def get_sys_info(): "Returns system information as a dict" blob = [] # get full commit hash commit = None if os.path.isdir(".git") and os.path.isdir("pandas"): try: ...
mit
jdmcbr/blaze
blaze/expr/collections.py
2
20040
from __future__ import absolute_import, division, print_function from functools import partial from itertools import chain import datashape from datashape import ( DataShape, Option, Record, Unit, dshape, var, Fixed, Var, promote, object_, ) from datashape.predicates import isscalar, iscollection, isrecord from t...
bsd-3-clause
jimgoo/zipline-fork
zipline/protocol.py
3
17052
# # Copyright 2013 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
smueller18/solar-thermal-climate-system
consumer/machine-state-prediction/consumer.py
1
3723
#!/usr/bin/env python3 import os import time import logging.config import pickle import pandas as pd from pca import PCAForPandas import kafka_connector.avro_loop_consumer as avro_loop_consumer from kafka_connector.avro_loop_consumer import AvroLoopConsumer from tsfresh.feature_extraction import extract_features fro...
mit
iamshang1/Projects
Advanced_ML/Human_Activity_Recognition/LSTM/lstm_within_subject.py
1
8787
import numpy as np import theano import theano.tensor as T import sys import random from sklearn.model_selection import train_test_split sys.setrecursionlimit(10000) class lstm(object): ''' long short term memory network for classifying human activity from incremental summary statistics paramete...
mit
kwilliams-mo/iris
lib/iris/tests/test_trajectory.py
2
8439
# (C) British Crown Copyright 2010 - 2013, Met Office # # This file is part of Iris. # # Iris 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 option) any l...
gpl-3.0
dhruvesh13/Audio-Genre-Classification
learn.py
1
4259
import sklearn from sklearn import linear_model from sklearn.neighbors import KNeighborsClassifier from sklearn.cross_validation import train_test_split from sklearn.metrics import confusion_matrix from sklearn.metrics import accuracy_score import matplotlib.pyplot as plt import scipy import os import sys import glob ...
mit
ankurankan/scikit-learn
examples/decomposition/plot_faces_decomposition.py
204
4452
""" ============================ Faces dataset decompositions ============================ This example applies to :ref:`olivetti_faces` different unsupervised matrix decomposition (dimension reduction) methods from the module :py:mod:`sklearn.decomposition` (see the documentation chapter :ref:`decompositions`) . """...
bsd-3-clause
fzalkow/scikit-learn
sklearn/utils/tests/test_linear_assignment.py
421
1349
# Author: Brian M. Clapper, G Varoquaux # License: BSD import numpy as np # XXX we should be testing the public API here from sklearn.utils.linear_assignment_ import _hungarian def test_hungarian(): matrices = [ # Square ([[400, 150, 400], [400, 450, 600], [300, 225, 300]], ...
bsd-3-clause
PeterRochford/SkillMetrics
Examples/taylor3.py
1
4261
''' How to create a Taylor diagram with labeled data points and modified axes A third example of how to create a Taylor diagram given one set of reference observations and multiple model predictions for the quantity. This example is a variation on the first example (taylor1) where now the data points are labeled and ...
gpl-3.0
axelmagn/metrics
ai-metrics/aimetrics/metrics.py
1
7181
import json import numpy as np from sklearn.cross_validation import (StratifiedShuffleSplit, StratifiedKFold, KFold) from sklearn.preprocessing import binarize, normalize from sklearn.metrics import (accuracy_score, roc_curve, roc_auc_score, f1_score, classification_report) from tor...
apache-2.0
aelsen/Systems_Integration_EMG
scripts_acquisition/myo.py
8
3086
from __future__ import print_function from collections import Counter, deque import sys import time import numpy as np try: from sklearn import neighbors, svm HAVE_SK = True except ImportError: HAVE_SK = False from common import * from myo_raw import MyoRaw SUBSAMPLE = 3 K = 15 class NNClassifier(obje...
mit
Adai0808/scikit-learn
benchmarks/bench_multilabel_metrics.py
276
7138
#!/usr/bin/env python """ A comparison of multilabel target formats and metrics over them """ from __future__ import division from __future__ import print_function from timeit import timeit from functools import partial import itertools import argparse import sys import matplotlib.pyplot as plt import scipy.sparse as...
bsd-3-clause
Garrett-R/scikit-learn
sklearn/neighbors/regression.py
39
10464
"""Nearest Neighbor Regression""" # Authors: Jake Vanderplas <vanderplas@astro.washington.edu> # Fabian Pedregosa <fabian.pedregosa@inria.fr> # Alexandre Gramfort <alexandre.gramfort@inria.fr> # Sparseness support by Lars Buitinck <L.J.Buitinck@uva.nl> # Multi-output support by Arna...
bsd-3-clause
m2dsupsdlclass/lectures-labs
labs/03_neural_recsys/movielens_paramsearch.py
1
9625
from math import floor, ceil from time import time from pathlib import Path from zipfile import ZipFile from urllib.request import urlretrieve from contextlib import contextmanager import random from pprint import pprint import json import numpy as np import pandas as pd import joblib from sklearn.model_selection impo...
mit
JosmanPS/scikit-learn
benchmarks/bench_plot_nmf.py
206
5890
""" Benchmarks of Non-Negative Matrix Factorization """ from __future__ import print_function from collections import defaultdict import gc from time import time import numpy as np from scipy.linalg import norm from sklearn.decomposition.nmf import NMF, _initialize_nmf from sklearn.datasets.samples_generator import...
bsd-3-clause
JLHulme/MhoPerformance
Voltage_plot.py
1
3051
#Required imports import math import matplotlib.pyplot as plt #Create time vector, in terms of samples, for a time period of 30cycles length = 30 #cycles sampleRate = 4 # samples per cycle time = [] #create global definition for a deg120 = (math.pi/180) * 120 a = math.cos(deg120)+math.sin(deg120)*1j for x in rang...
bsd-2-clause
paninski-lab/yass
src/yass/cluster/cluster.py
1
45893
# Class to do parallelized clustering import os import numpy as np import networkx as nx from sklearn.decomposition import PCA from scipy.spatial import cKDTree from scipy.stats import chi2 from yass.template import shift_chans, align_get_shifts_with_ref from yass import mfm from yass.util import absolute_path_to_asse...
apache-2.0
benhoff/vexbot
setup.py
2
3549
import os import re from setuptools import find_packages, setup from vexbot.extension_metadata import extensions VERSIONFILE = 'vexbot/_version.py' verstrline = open(VERSIONFILE, 'rt').read() VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]" mo = re.search(VSRE, verstrline, re.M) if mo: verstr = mo.group(1) else: ...
gpl-3.0
DavidTingley/ephys-processing-pipeline
installation/klustaviewa-0.3.0/build/lib.linux-x86_64-2.7/kwiklib/dataio/tests/test_klustersloader.py
2
17397
"""Unit tests for loader module.""" # ----------------------------------------------------------------------------- # Imports # ----------------------------------------------------------------------------- import os from collections import Counter import numpy as np import numpy.random as rnd import pandas ...
gpl-3.0
zigahertz/2013-Sep-HR-ML-sprint
py/randomforest.py
1
3790
""" random forest """ import numpy as np import csv as csv from sklearn.ensemble import RandomForestClassifier csv_file_object = csv.reader(open('train.csv', 'rb')) #Load in the training csv file header = csv_file_object.next() #Skip the fist line as it is a header train_data=[] #Creat a variable called 'train_data' ...
mit
Lawrence-Liu/scikit-learn
examples/linear_model/plot_ols_3d.py
350
2040
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Sparsity Example: Fitting only features 1 and 2 ========================================================= Features 1 and 2 of the diabetes-dataset are fitted and plotted below. It illustrates that although feature...
bsd-3-clause
andim/scipy
scipy/stats/morestats.py
3
92737
# Author: Travis Oliphant, 2002 # # Further updates and enhancements by many SciPy developers. # from __future__ import division, print_function, absolute_import import math import warnings from collections import namedtuple import numpy as np from numpy import (isscalar, r_, log, around, unique, asarray, ...
bsd-3-clause
piyush8311/ns3-arp
src/core/examples/sample-rng-plot.py
188
1246
# -*- Mode:Python; -*- # /* # * This program is free software; you can redistribute it and/or modify # * it under the terms of the GNU General Public License version 2 as # * published by the Free Software Foundation # * # * This program is distributed in the hope that it will be useful, # * but WITHOUT ANY WARRA...
gpl-2.0
microsoft/task_oriented_dialogue_as_dataflow_synthesis
src/dataflow/onmt_helpers/evaluate_onmt_predictions.py
1
6406
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. """ Semantic Machines\N{TRADE MARK SIGN} software. Evaluates 1best predictions. Computes both turn-level and dialogue-level accuracy. """ import argparse import csv import json from dataclasses import dataclass from typing import List, Option...
mit
ningchi/scikit-learn
examples/text/hashing_vs_dict_vectorizer.py
284
3265
""" =========================================== FeatureHasher and DictVectorizer Comparison =========================================== Compares FeatureHasher and DictVectorizer by using both to vectorize text documents. The example demonstrates syntax and speed only; it doesn't actually do anything useful with the e...
bsd-3-clause
chatcannon/scipy
scipy/signal/windows.py
20
54134
"""The suite of window functions.""" from __future__ import division, print_function, absolute_import import warnings import numpy as np from scipy import fftpack, linalg, special from scipy._lib.six import string_types __all__ = ['boxcar', 'triang', 'parzen', 'bohman', 'blackman', 'nuttall', 'blackmanhar...
bsd-3-clause
TheArbiter/Networks
lab4/lab4exercise1/util/helper.py
6
3381
''' Helper module for the plot scripts. ''' import re import itertools import matplotlib as m import os if os.uname()[0] == "Darwin": m.use("MacOSX") else: m.use("Agg") import matplotlib.pyplot as plt import argparse import math def read_list(fname, delim=','): lines = open(fname).xreadlines() ret = [...
gpl-3.0
jklenzing/pysat
pysat/ssnl/plot.py
2
3420
from __future__ import print_function from __future__ import absolute_import import matplotlib as mpl import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import numpy as np import warnings def scatterplot(inst, labelx, labely, data_label, datalim, xlim=None, ylim=None): """Ret...
bsd-3-clause
0x0all/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/patches.py
69
110325
# -*- coding: utf-8 -*- from __future__ import division import math import matplotlib as mpl import numpy as np import matplotlib.cbook as cbook import matplotlib.artist as artist import matplotlib.colors as colors import matplotlib.transforms as transforms from matplotlib.path import Path # these are not available ...
gpl-3.0
larsoner/mne-python
examples/visualization/plot_3d_to_2d.py
15
4941
""" .. _ex-electrode-pos-2d: ==================================================== How to convert 3D electrode positions to a 2D image. ==================================================== Sometimes we want to convert a 3D representation of electrodes into a 2D image. For example, if we are using electrocorticography ...
bsd-3-clause
PmagPy/PmagPy
programs/conversion_scripts2/bgc_magic2.py
3
8598
#!/usr/bin/env python from __future__ import division from __future__ import print_function from builtins import str from past.utils import old_div import pandas as pd import sys import os import numpy as np import pmagpy.pmag as pmag def main(command_line=True, **kwargs): """ NAME bgc_magic.py D...
bsd-3-clause
jpinedaf/pyspeckit
pyspeckit/spectrum/plotters.py
4
35855
""" ======= Plotter ======= .. moduleauthor:: Adam Ginsburg <adam.g.ginsburg@gmail.com> """ from __future__ import print_function import matplotlib import matplotlib.figure import numpy as np import astropy.units as u import copy import inspect from astropy import log # this mess is to handle a nested hell of differe...
mit
rishikksh20/scikit-learn
examples/ensemble/plot_bias_variance.py
357
7324
""" ============================================================ Single estimator versus bagging: bias-variance decomposition ============================================================ This example illustrates and compares the bias-variance decomposition of the expected mean squared error of a single estimator again...
bsd-3-clause
saebrahimi/Emotion-Recognition-EmotiW2015
common/disptools.py
2
11942
#!/usr/bin/env python #-*- coding: utf-8 -*- import os import matplotlib import matplotlib.pyplot as plt import numpy as np def pred_visualization(fname, arrays, picks, img_shape, tile_spacing=(0,0), scale_rows_to_unit_interval=True, output_pixel_vals=True): """Used ...
mit
JackKelly/neuralnilm_prototype
scripts/e334.py
2
5407
from __future__ import print_function, division import matplotlib import logging from sys import stdout matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab! from neuralnilm import (Net, RealApplianceSource, BLSTMLayer, DimshuffleLayer, Bidirectio...
mit
jreback/pandas
pandas/io/pytables.py
1
167728
""" High level interface to PyTables for reading and writing pandas data structures to disk """ from contextlib import suppress import copy from datetime import date, tzinfo import itertools import os import re from textwrap import dedent from typing import ( TYPE_CHECKING, Any, Callable, Dict, List...
bsd-3-clause
ToFuProject/tofu
tofu/data/_core.py
1
174350
# -*- coding: utf-8 -*- # Built-in import sys import os import itertools as itt import copy import warnings from abc import ABCMeta, abstractmethod import inspect # Common import numpy as np import scipy.interpolate as scpinterp import matplotlib.pyplot as plt from matplotlib.tri import Triangulation as mplTri # to...
mit
gregcaporaso/q2d2
setup.py
1
1808
#!/usr/bin/env python import re import ast from setuptools import find_packages, setup # version parsing from __init__ pulled from Flask's setup.py # https://github.com/mitsuhiko/flask/blob/master/setup.py _version_re = re.compile(r'__version__\s+=\s+(.*)') with open('q2d2/__init__.py', 'rb') as f: hit = _versio...
bsd-3-clause
pythonvietnam/scikit-learn
examples/linear_model/plot_omp.py
385
2263
""" =========================== Orthogonal Matching Pursuit =========================== Using orthogonal matching pursuit for recovering a sparse signal from a noisy measurement encoded with a dictionary """ print(__doc__) import matplotlib.pyplot as plt import numpy as np from sklearn.linear_model import OrthogonalM...
bsd-3-clause
schets/scikit-learn
sklearn/neural_network/tests/test_rbm.py
142
6276
import sys import re import numpy as np from scipy.sparse import csc_matrix, csr_matrix, lil_matrix from sklearn.utils.testing import (assert_almost_equal, assert_array_equal, assert_true) from sklearn.datasets import load_digits from sklearn.externals.six.moves import cStringIO as ...
bsd-3-clause
spbguru/repo1
examples/opf/clients/hotgym/anomaly/one_gym/run.py
15
4940
#!/usr/bin/env python # ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2013, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions ...
gpl-3.0
theDataGeek/pyhsmm
setup.py
2
3380
from distutils.core import setup, Extension import numpy as np import sys import os from glob import glob PYHSMM_VERSION = "0.1.3" ########################### # compilation arguments # ########################### extra_link_args = [] extra_compile_args = [] if '--with-old-clang' in sys.argv: sys.argv.remove('...
mit
pepper-johnson/Erudition
Thesis/Mallet/notebooks/models/imports/features.py
1
1856
import numpy as np import pandas as pd FEATURE_COLUMNS_WITH_DATE = [ 'date', 'chibs', 'hm', 'is', 'lr', 'price' ] INPUT_COLUMNS = [ 'chibs', 'hm', 'is', 'lr', ] OUTPUT_COLUMNS = [ 'price' ] def create_dataset(df): ## assert the input is a pandas dataframe ass...
apache-2.0
jonwright/ImageD11
ImageD11/depreciated/rebin2d.py
1
3961
# ImageD11_v0.4 Software for beamline ID11 # Copyright (C) 2005 Jon Wright # # This program 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, or # (at your option) any later ver...
gpl-2.0
tawsifkhan/scikit-learn
examples/plot_digits_pipe.py
250
1809
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Pipelining: chaining a PCA and a logistic regression ========================================================= The PCA does an unsupervised dimensionality reduction, while the logistic regression does the predictio...
bsd-3-clause
ABoothInTheWild/baseball-research
true2018PlayoffPreds.py
1
18268
# -*- coding: utf-8 -*- """ Created on Sun Aug 05 22:49:05 2018 @author: Alexander """ #2018 Preseason Playoff Odds import heapq from collections import Counter import pandas as pd import numpy as np from scipy.stats import beta import os #read data os.chdir('C:/Users/abooth/Documents/Python Scripts/...
gpl-3.0
CG-F16-24-Rutgers/steersuite-rutgers
steerstats/tools/plotting/plotMultiObjectiveData3D.py
8
2231
import csv from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt from matplotlib import cm import sys import scipy from scipy.interpolate import bisplrep from scipy.interpolate import bisplev import numpy as np sys.path.append('../../') from util import readCSVDictToMutliObjData from util import get...
gpl-3.0
JKarathiya/Lean
Algorithm.Python/NLTKSentimentTradingAlgorithm.py
1
3025
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. # Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. # # 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 Lic...
apache-2.0
MartinDelzant/scikit-learn
examples/applications/wikipedia_principal_eigenvector.py
233
7819
""" =============================== Wikipedia principal eigenvector =============================== A classical way to assert the relative importance of vertices in a graph is to compute the principal eigenvector of the adjacency matrix so as to assign to each vertex the values of the components of the first eigenvect...
bsd-3-clause
jreback/pandas
pandas/tests/frame/test_query_eval.py
2
47508
from io import StringIO import operator import numpy as np import pytest import pandas.util._test_decorators as td import pandas as pd from pandas import DataFrame, Index, MultiIndex, Series, date_range import pandas._testing as tm from pandas.core.computation.check import NUMEXPR_INSTALLED PARSERS = "python", "pan...
bsd-3-clause
Midafi/scikit-image
doc/examples/plot_multiblock_local_binary_pattern.py
22
2498
""" =========================================================== Multi-Block Local Binary Pattern for texture classification =========================================================== This example shows how to compute multi-block local binary pattern (MB-LBP) features as well as how to visualize them. The features ar...
bsd-3-clause
dhomeier/astropy
astropy/nddata/utils.py
3
32016
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module includes helper functions for array operations. """ from copy import deepcopy import sys import types import warnings import numpy as np from astropy import units as u from astropy.coordinates import SkyCoord from astropy.utils import la...
bsd-3-clause
andyjost/slang
scripts/neural_nets.py
1
1536
#!/usr/bin/env python from itertools import * from sklearn import datasets from sklearn import preprocessing from sklearn import svm from sklearn.metrics import classification_report from sklearn.model_selection import GridSearchCV from sklearn.naive_bayes import * from sklearn.neural_network import MLPClassifier impor...
gpl-3.0
amolkahat/pandas
pandas/tests/arithmetic/test_numeric.py
1
32501
# -*- coding: utf-8 -*- # Arithmetc tests for DataFrame/Series/Index/Array classes that should # behave identically. # Specifically for numeric dtypes from decimal import Decimal import operator import pytest import numpy as np import pandas as pd import pandas.util.testing as tm from pandas.compat import PY3, Itera...
bsd-3-clause
Tong-Chen/scikit-learn
sklearn/metrics/tests/test_pairwise.py
4
18398
import numpy as np from numpy import linalg from scipy.sparse import dok_matrix, csr_matrix, issparse from scipy.spatial.distance import cosine, cityblock, minkowski from sklearn.utils.testing import assert_greater from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_al...
bsd-3-clause
Hbl15/ThinkStats2
code/populations.py
68
2609
"""This file contains code used in "Think Stats", by Allen B. Downey, available from greenteapress.com Copyright 2010 Allen B. Downey License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html """ from __future__ import print_function import csv import logging import sys import numpy as np import pandas import thinkpl...
gpl-3.0
scikit-learn-contrib/categorical-encoding
tests/test_count.py
1
10805
import pandas as pd from unittest import TestCase # or `from unittest import ...` if on Python 3.4+ import numpy as np import category_encoders as encoders X = pd.DataFrame({ 'none': [ 'A', 'A', 'B', None, None, 'C', None, 'C', None, 'B', 'A', 'A', 'C', 'B', 'B', 'A', 'A', None, 'B', None ], ...
bsd-3-clause
zihua/scikit-learn
examples/cluster/plot_face_segmentation.py
71
2839
""" =================================================== Segmenting the picture of a raccoon face in regions =================================================== This example uses :ref:`spectral_clustering` on a graph created from voxel-to-voxel difference on an image to break this image into multiple partly-homogeneous...
bsd-3-clause
weinbe58/QuSpin
examples/scripts/example3.py
3
5466
from __future__ import print_function, division import sys,os # line 4 and line 5 below are for development purposes and can be removed qspin_path = os.path.join(os.getcwd(),"../../") sys.path.insert(0,qspin_path) ######################################################################################## # ...
bsd-3-clause
dyoung418/tensorflow
tensorflow/python/estimator/inputs/pandas_io.py
86
4503
# 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
giorgiop/scipy
doc/source/tutorial/examples/normdiscr_plot2.py
84
1642
import numpy as np import matplotlib.pyplot as plt from scipy import stats npoints = 20 # number of integer support points of the distribution minus 1 npointsh = npoints / 2 npointsf = float(npoints) nbound = 4 #bounds for the truncated normal normbound = (1 + 1 / npointsf) * nbound #actual bounds of truncated normal ...
bsd-3-clause
aev3/trading-with-python
lib/yahooFinance.py
76
8290
# -*- coding: utf-8 -*- # Author: Jev Kuznetsov <jev.kuznetsov@gmail.com> # License: BSD """ Toolset working with yahoo finance data This module includes functions for easy access to YahooFinance data Functions ---------- - `getHistoricData` get historic data for a single symbol - `getQuote` get cur...
bsd-3-clause
awacha/sastool
tests/centering/beamfinding_test_evaluate.py
1
1581
import os import numpy as np import matplotlib.pyplot as plt import re import sastool import matplotlib matplotlib.rcParams['font.size']=8 xmin=40 xmax=210 ymin=40 ymax=210 modes=['slice','azim','azimfold'] bcxfiles=[f for f in os.listdir('.') if re.match('bcx[a-z]+_([0-9]+).npy',f)] print(bcxfiles) fsns=set([re.mat...
bsd-3-clause
bakfu/bakfu
bakfu/process/vectorize/vec_sklearn.py
2
3972
# -*- coding: utf-8 -*- ''' This is an interface to sklearn vectorizer classes. ''' import sklearn from sklearn.feature_extraction.text import CountVectorizer as SKCountVectorizer from sklearn.feature_extraction.text import TfidfVectorizer as SKTfidfVectorizer from ...core.routes import register from .base import...
bsd-3-clause
bhargav/scikit-learn
examples/linear_model/plot_theilsen.py
100
3846
""" ==================== Theil-Sen Regression ==================== Computes a Theil-Sen Regression on a synthetic dataset. See :ref:`theil_sen_regression` for more information on the regressor. Compared to the OLS (ordinary least squares) estimator, the Theil-Sen estimator is robust against outliers. It has a breakd...
bsd-3-clause
scikit-nano/scikit-nano
setup.py
2
10936
#!/usr/bin/env python # -*- coding: utf-8 -*- """Python toolkit for generating and analyzing nanostructure data""" from __future__ import absolute_import, division, print_function, \ unicode_literals __docformat__ = 'restructuredtext en' import os import sys import shutil import subprocess from distutils.command...
bsd-2-clause
poppingtonic/BayesDB
bayesdb/tests/experiments/estimate_the_full_joint_dist.py
2
6142
# # Copyright (c) 2010-2014, MIT Probabilistic Computing Project # # Lead Developers: Jay Baxter and Dan Lovell # Authors: Jay Baxter, Dan Lovell, Baxter Eaves, Vikash Mansinghka # Research Leads: Vikash Mansinghka, Patrick Shafto # # Licensed under the Apache License, Version 2.0 (the "License"); # you may...
apache-2.0
chrishavlin/nyc_taxi_viz
src/taxi_main.py
1
12620
""" taxi_main.py module for loading the raw csv taxi files. Copyright (C) 2016 Chris Havlin, <https://chrishavlin.wordpress.com> This program 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 ...
gpl-3.0
ettm2012/MissionPlanner
Lib/site-packages/numpy/fft/fftpack.py
59
39653
""" Discrete Fourier Transforms Routines in this module: fft(a, n=None, axis=-1) ifft(a, n=None, axis=-1) rfft(a, n=None, axis=-1) irfft(a, n=None, axis=-1) hfft(a, n=None, axis=-1) ihfft(a, n=None, axis=-1) fftn(a, s=None, axes=None) ifftn(a, s=None, axes=None) rfftn(a, s=None, axes=None) irfftn(a, s=None, axes=None...
gpl-3.0
maximus009/kaggle-galaxies
predict_augmented_npy_maxout2048_extradense_pysexgen1_dup.py
7
9736
""" Load an analysis file and redo the predictions on the validation set / test set, this time with augmented data and averaging. Store them as numpy files. """ import numpy as np # import pandas as pd import theano import theano.tensor as T import layers import cc_layers import custom import load_data import realtime...
bsd-3-clause
hdmetor/scikit-learn
examples/plot_multilabel.py
87
4279
# 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
ammarkhann/FinalSeniorCode
lib/python2.7/site-packages/pandas/tests/plotting/common.py
6
19480
#!/usr/bin/env python # coding: utf-8 import pytest import os import warnings from pandas import DataFrame, Series from pandas.compat import zip, iteritems from pandas.util._decorators import cache_readonly from pandas.core.dtypes.api import is_list_like import pandas.util.testing as tm from pandas.util.testing impor...
mit
BiaDarkia/scikit-learn
examples/ensemble/plot_forest_importances.py
168
1793
""" ========================================= Feature importances with forests of trees ========================================= This examples shows the use of forests of trees to evaluate the importance of features on an artificial classification task. The red bars are the feature importances of the forest, along wi...
bsd-3-clause
Adai0808/scikit-learn
sklearn/linear_model/ransac.py
191
14261
# coding: utf-8 # Author: Johannes Schönberger # # License: BSD 3 clause import numpy as np from ..base import BaseEstimator, MetaEstimatorMixin, RegressorMixin, clone from ..utils import check_random_state, check_array, check_consistent_length from ..utils.random import sample_without_replacement from ..utils.valid...
bsd-3-clause
markovianlabs/pychain
src/mcmc.py
1
6943
""" Markov Chain Monte Carlo (MCMC) method using Metropolis-Hastings algorithm. Copyright: MarkovianLabs """ import numpy as np import matplotlib.pyplot as plt from sys import exit #---------------------------------------------------------- __author__ = ("Irshad Mohammed <creativeishu@gmail.com>") #---------------...
mit
Barmaley-exe/scikit-learn
examples/plot_digits_pipe.py
250
1809
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Pipelining: chaining a PCA and a logistic regression ========================================================= The PCA does an unsupervised dimensionality reduction, while the logistic regression does the predictio...
bsd-3-clause
RuthAngus/chronometer
chronometer/fit_dispersion.py
1
2000
import numpy as np from action_age_evolution import calc_dispersion import emcee import corner import matplotlib.pyplot as plt plotpar = {'axes.labelsize': 18, 'font.size': 10, 'legend.fontsize': 15, 'xtick.labelsize': 18, 'ytick.labelsize': 18, 'text.usetex': Tru...
mit
spallavolu/scikit-learn
sklearn/datasets/tests/test_mldata.py
384
5221
"""Test functionality of mldata fetching utilities.""" import os import shutil import tempfile import scipy as sp from sklearn import datasets from sklearn.datasets import mldata_filename, fetch_mldata from sklearn.utils.testing import assert_in from sklearn.utils.testing import assert_not_in from sklearn.utils.test...
bsd-3-clause
robbymeals/scikit-learn
sklearn/linear_model/tests/test_passive_aggressive.py
121
6117
import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_less from sklearn.utils.testing import assert_greater from sklearn.utils.testing import assert_array_almost_equal, assert_array_equal from sklearn.utils.testing import assert_raises from sklearn.base import ClassifierMixin from skle...
bsd-3-clause
public-ink/public-ink
server/appengine/lib/matplotlib/offsetbox.py
10
54984
""" 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...
gpl-3.0
tlhr/plumology
plumology/vis.py
1
16471
"""vis - Visualisation and plotting tools""" from typing import Union, Sequence, Optional, List, Tuple import sys import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib.collections import RegularPolyCollection from matplotlib.colors import LinearSegmentedColormap, ListedColormap from ...
mit
DTMilodowski/LiDAR_canopy
src/inventory_based_LAD_profiles.py
1
40714
# This contains code to estimate LAD profiles based on field measurements of # tree height and crown dimensions, in addition to crown depth based on a # regional allometric equation. import numpy as np from scipy import stats pi=np.pi # linear regression with confidence intervals and prediction intervals def linear_r...
gpl-3.0
gfyoung/numpy
numpy/lib/npyio.py
2
84419
from __future__ import division, absolute_import, print_function import sys import os import re import itertools import warnings import weakref from operator import itemgetter, index as opindex import numpy as np from . import format from ._datasource import DataSource from numpy.core.multiarray import packbits, unpa...
bsd-3-clause
Shekharrajak/mubosym
mubosym/mubosym_core.py
1
95748
# -*- coding: utf-8 -*- """ all mubosym related core classes ================================ Created on Sun Mar 8 11:50:46 2015 @author: oliver """ from __future__ import print_function, absolute_import import os.path,sys,time,copy try: import pandas as pd no_pandas = False except: print( 'can not use p...
mit
yonglehou/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
f3r/scikit-learn
sklearn/decomposition/truncated_svd.py
30
7896
"""Truncated SVD for sparse matrices, aka latent semantic analysis (LSA). """ # Author: Lars Buitinck <L.J.Buitinck@uva.nl> # Olivier Grisel <olivier.grisel@ensta.org> # Michael Becker <mike@beckerfuffle.com> # License: 3-clause BSD. import numpy as np import scipy.sparse as sp try: from scipy.sp...
bsd-3-clause
tsaoyu/D3HRE
D3HRE/core/mission_utility.py
1
7731
import numpy as np import pandas as pd import nvector as nv from math import radians, cos, sin, asin, sqrt from datetime import timedelta from D3HRE.core.get_hash import hash_value from D3HRE.core.dataframe_utility import full_day_cut def haversine(lon1, lat1, lon2, lat2): """ Calculate the great circle dis...
gpl-3.0
n7jti/machine_learning
adaboost/newsgroups.py
1
4192
#!/usr/bin/python2 from scipy import * import scipy.sparse as sp import scipy.linalg as la #See http://scikit-learn.org/stable/modules/feature_extraction.html import sklearn.feature_extraction as fe import tok import dstump as ds import pylab as pl import numpy as np import operator from datetime import datetime def ...
apache-2.0
mhue/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
pradyu1993/scikit-learn
sklearn/svm/tests/test_bounds.py
6
2069
import nose from nose.tools import assert_true 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 dense_X = [[-1, 0], [0, 1], [1, 1], [1, 1]] sparse_X = sp.csr_matrix(dense_X) Y1 = ...
bsd-3-clause