repo_name
stringlengths
7
90
path
stringlengths
5
191
copies
stringlengths
1
3
size
stringlengths
4
6
content
stringlengths
976
581k
license
stringclasses
15 values
tosolveit/scikit-learn
sklearn/metrics/regression.py
175
16953
"""Metrics to assess performance on regression task Functions named as ``*_score`` return a scalar value to maximize: the higher the better Function named as ``*_error`` or ``*_loss`` return a scalar value to minimize: the lower the better """ # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Ma...
bsd-3-clause
themrmax/scikit-learn
sklearn/cross_decomposition/pls_.py
4
30509
""" The :mod:`sklearn.pls` module implements Partial Least Squares (PLS). """ # Author: Edouard Duchesnay <edouard.duchesnay@cea.fr> # License: BSD 3 clause import warnings from abc import ABCMeta, abstractmethod import numpy as np from scipy.linalg import pinv2, svd from scipy.sparse.linalg import svds from ..base...
bsd-3-clause
reflectometry/osrefl
osrefl/loaders/binned_data.py
1
32960
#!/usr/bin/python # -*- coding: utf-8 -*- # # check to see if all parameters are set on the command line # if they are, then don't open GUI interface from math import * import sys #from Tkinter import * #import tkMessageBox #import tkFileDialog #from FileDialog import * from osrefl.loaders.reduction import * import osr...
bsd-3-clause
bigswitch/snac-nox
src/scripts/buildtest/lookup.py
1
1569
#!/usr/bin/python import matplotlib matplotlib.use('Agg') import pickle import pwd import os import info import graph def create_image(argv): p = info.Profile() b = info.Build() t = info.Test() r = info.Result() values = [] for v in argv[1:]: if v == 'Tru...
gpl-3.0
krikru/tensorflow-opencl
tensorflow/contrib/learn/python/learn/dataframe/dataframe.py
85
4704
# 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
rekhajoshm/spark
python/pyspark/ml/clustering.py
5
50284
# # 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
cloudera/ibis
ibis/backends/tests/test_geospatial.py
2
17942
""" Tests for geo spatial data types""" import numpy as np import pytest from numpy import testing from pytest import param import ibis geopandas = pytest.importorskip('geopandas') shapely = pytest.importorskip('shapely') shapely_wkt = pytest.importorskip('shapely.wkt') # geo literals declaration point_0 = ibis.lite...
apache-2.0
juvoinc/airflow
airflow/hooks/presto_hook.py
24
3472
# -*- coding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software ...
apache-2.0
hypergravity/hrs
setup.py
1
1199
from distutils.core import setup if __name__ == '__main__': setup( name='hrs', version='1.2.2', author='Bo Zhang', author_email='bozhang@nao.cas.cn', # py_modules=['hrs'], description='High Resolution Spectrograph (2.16m) Reduction pipeline.', # short description ...
bsd-3-clause
CGATOxford/proj029
scripts/PipelineProj029.py
1
11837
################################################# # classes and functions for pipeline_proj029.py ################################################# import sqlite3 import os, re, sys import collections from pandas import * import CGAT.Pipeline as P from rpy2.robjects import r as R def buildRelativeAbundanceMatrix(dat...
bsd-3-clause
CVML/scikit-learn
examples/cluster/plot_adjusted_for_chance_measures.py
286
4353
""" ========================================================== Adjustment for chance in clustering performance evaluation ========================================================== The following plots demonstrate the impact of the number of clusters and number of samples on various clustering performance evaluation me...
bsd-3-clause
CooperLuan/crm_for_shaodong
main.py
1
4965
import os from datetime import datetime import logbook from flask import Flask, render_template, jsonify, request import pandas as pd import numpy as np app = Flask('StatsWeb') log = logbook DATA = { 'df': None, 'select_cols': [], 'sum_cols': [], } def _setup(stream): global DATA df = pd.read_ex...
mit
kevin-intel/scikit-learn
sklearn/cluster/tests/test_affinity_propagation.py
2
9355
""" Testing for Clustering methods """ import numpy as np import pytest from scipy.sparse import csr_matrix from sklearn.exceptions import ConvergenceWarning from sklearn.utils._testing import assert_array_equal from sklearn.cluster import AffinityPropagation from sklearn.cluster._affinity_propagation import ( ...
bsd-3-clause
rmeertens/paparazzi
sw/airborne/test/stabilization/compare_ref_quat.py
48
1123
#! /usr/bin/env python from __future__ import division, print_function, absolute_import import numpy as np import matplotlib.pyplot as plt from ref_quat_float import RefQuatFloat from ref_quat_int import RefQuatInt steps = 512 * 2 ref_float_res = np.zeros((steps, 3)) ref_int_res = np.zeros((steps, 3)) ref_float = ...
gpl-2.0
schets/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
mne-tools/mne-tools.github.io
0.16/_downloads/plot_ssp_projs_sensitivity_map.py
11
1268
""" ================================== Sensitivity map of SSP projections ================================== This example shows the sources that have a forward field similar to the first SSP vector correcting for ECG. """ # Author: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # # License: BSD (3-clause...
bsd-3-clause
chrisburr/scikit-learn
examples/feature_stacker.py
50
1910
""" ================================================= Concatenating multiple feature extraction methods ================================================= In many real-world examples, there are many ways to extract features from a dataset. Often it is beneficial to combine several methods to obtain good performance. Th...
bsd-3-clause
xzh86/scikit-learn
examples/cluster/plot_dict_face_patches.py
337
2747
""" Online learning of a dictionary of parts of faces ================================================== This example uses a large dataset of faces to learn a set of 20 x 20 images patches that constitute faces. From the programming standpoint, it is interesting because it shows how to use the online API of the sciki...
bsd-3-clause
ryanjmccall/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/lines.py
69
48233
""" This module contains all the 2D line class which can draw with a variety of line styles, markers and colors. """ # TODO: expose cap and join style attrs from __future__ import division import numpy as np from numpy import ma from matplotlib import verbose import artist from artist import Artist from cbook import ...
gpl-3.0
margulies/topography
utils/network_eigenvector_centrality.py
6
2062
import os, h5py from time import time import numpy as np from scipy import sparse from sklearn.utils import extmath """Import data: """ def importData(sub) f = h5py.File(('/scr/litauen1/%s.hcp.lh.mat' % sub),'r') data = np.array(f.get('connData')) cortex = np.array(f.get('cortex')) - 1 return data, c...
mit
williford/nolearn
nolearn/lasagne/tests/test_base.py
1
21757
import pickle from lasagne.layers import ConcatLayer from lasagne.layers import DenseLayer from lasagne.layers import InputLayer from lasagne.layers import Layer from lasagne.nonlinearities import identity from lasagne.nonlinearities import softmax from lasagne.objectives import categorical_crossentropy from lasagne.u...
mit
CDIPS-AI-2017/pensieve
Notebooks/word2vec/run_Word2Vec.py
1
4391
# ******************************************************************************* # ** # ** Author: Michael Lomnitz (mrlomnitz@lbl.gov) # ** Python module to run word embedding (word2vec) using skipgram or continuos # ** bag of words (CBOW) models. Output is then plotted using SKlearn ...
apache-2.0
janelia-idf/sleep_assay
host/python/sleep_assay/sleep_assay.py
2
31231
# -*- coding: utf-8 -*- from __future__ import print_function, division import serial import time import atexit import yaml import sys import argparse import datetime import platform import json import csv import os import numpy as np import matplotlib.pyplot as plt import math from serial_device2 import SerialDevice,...
bsd-3-clause
nmartensen/pandas
pandas/core/generic.py
1
251892
# pylint: disable=W0231,E1101 import collections import warnings import operator import weakref import gc import json import numpy as np import pandas as pd from pandas._libs import tslib, lib from pandas.core.dtypes.common import ( _ensure_int64, _ensure_object, is_scalar, is_number, is_integer, ...
bsd-3-clause
tlawrence3/tsfm
docs/conf.py
1
5972
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # tsfm documentation build configuration file, created by # sphinx-quickstart on Thu Aug 31 15:30:57 2017. # # 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 # autog...
lgpl-3.0
wanggang3333/scikit-learn
sklearn/neighbors/approximate.py
128
22351
"""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
sileht/gnocchi
gnocchi/carbonara.py
1
34814
# -*- encoding: utf-8 -*- # # Copyright © 2016-2018 Red Hat, Inc. # Copyright © 2014-2015 eNovance # # 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/LICE...
apache-2.0
olafhauk/mne-python
mne/tests/test_source_space.py
7
43205
# -*- coding: utf-8 -*- # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Eric Larson <larson.eric.d@gmail.com> # # License: BSD (3-clause) import os.path as op from shutil import copytree import pytest import scipy import numpy as np from numpy.testing import (assert_array_equal, assert_allclose...
bsd-3-clause
ceos-seo/Data_Cube_v2
agdc-v2/datacube/analytics/utils/analytics_utils.py
1
5498
# ------------------------------------------------------------------------------ # Name: analytics_utils.py # Purpose: Helper utilities # # Author: Peter Wang # # Created: 14 July 2015 # Copyright: 2015 Commonwealth Scientific and Industrial Research Organisation # (CSIRO) # Ada...
apache-2.0
diegocavalca/Studies
programming/Python/Machine-Learning/Introduction-Udacity/final_project/tester.py
14
4509
#!/usr/bin/pickle """ a basic script for importing student's POI identifier, and checking the results that they get from it requires that the algorithm, dataset, and features list be written to my_classifier.pkl, my_dataset.pkl, and my_feature_list.pkl, respectively that process should happen a...
cc0-1.0
idlead/scikit-learn
examples/cluster/plot_color_quantization.py
297
3443
# -*- coding: utf-8 -*- """ ================================== Color Quantization using K-Means ================================== Performs a pixel-wise Vector Quantization (VQ) of an image of the summer palace (China), reducing the number of colors required to show the image from 96,615 unique colors to 64, while pre...
bsd-3-clause
ishank08/scikit-learn
examples/classification/plot_classification_probability.py
138
2871
""" =============================== Plot classification probability =============================== Plot the classification probability for different classifiers. We use a 3 class dataset, and we classify it with a Support Vector classifier, L1 and L2 penalized logistic regression with either a One-Vs-Rest or multinom...
bsd-3-clause
vlsd/nlsymb
flat_sim.py
1
4781
# this is written for python2.7 # will not work with python3.3 # TODO figure out why!? import numpy as np import sympy as sym from sympy import Symbol as S import nlsymb # nlsymb = reload(nlsymb) from nlsymb import Timer, LineSearch, np, colored from nlsymb.sys import * from nlsymb.lqr import * # coming soon to a ...
mit
fhirschmann/penchy
penchy/jobs/plots.py
1
14963
""" This module provides plotting filters. .. moduleauthor:: Pascal Wittmann <mail@pascal-wittmann.de> :copyright: PenchY Developers 2011-2012, see AUTHORS :license: MIT License, see LICENSE """ from __future__ import division import itertools import logging from penchy.jobs.elements import Filter from penchy...
mit
CWSL/access-cm-tools
visualise/zonal_movie.py
1
13846
#!/usr/bin/env python import sys import numpy as np import netCDF4 as nc import argparse import os import shutil import glob import subprocess as sp import matplotlib #matplotlib.use('Agg') from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt import matplotlib.colors as colors """ Make a movie whi...
apache-2.0
hillairet/analysis-for-safer-roads
CSVtoSQLconverter.py
2
9874
#!/usr/bin/python import pandas as pd from pandas import DataFrame,Series import numpy as np import datetime as dt from optparse import OptionParser import mysql.connector from sqlalchemy import create_engine import netrc def clean_up_characteristics(Year): '''Return the cleaned up dataframe of the characteris...
gpl-3.0
saifrahmed/bokeh
bokeh/charts/builder/timeseries_builder.py
26
6252
"""This is the Bokeh charts interface. It gives you a high level API to build complex plot is a simple way. This is the TimeSeries class which lets you build your TimeSeries charts just passing the arguments to the Chart class and calling the proper functions. """ #-----------------------------------------------------...
bsd-3-clause
cainesap/mapMakeR
languagesOfTheWorld/fetchGlottologData.py
1
4909
## parse Glottolog JSON data ## PRELIMS # libs import json, urllib2 import pandas as pd # vars withgeoCount = 0 # count languoids with lat/long coordinates nongeoCount = 0 # count languoids without lat/long coordinates maxclass = 0 # what's the longest classification? NONGEOs = []; IDs = []; NAMEs = []; TYPEs = []...
mit
abhitopia/tensorflow
tensorflow/contrib/learn/python/learn/learn_io/data_feeder.py
88
31139
# 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
abhisg/scikit-learn
sklearn/cross_decomposition/tests/test_pls.py
215
11427
import numpy as np from sklearn.utils.testing import (assert_array_almost_equal, assert_array_equal, assert_true, assert_raise_message) from sklearn.datasets import load_linnerud from sklearn.cross_decomposition import pls_ from nose.tools import assert_equal def test_pls(): d =...
bsd-3-clause
zaxliu/deepnap
experiments/kdd-exps/experiment_message_2016-6-12_G5_BUF2_AR1_b5_legacy.py
1
4372
# System built-in modules import time from datetime import datetime import sys import os from multiprocessing import Pool # Project dependency modules import pandas as pd pd.set_option('mode.chained_assignment', None) # block warnings due to DataFrame value assignment import lasagne # Project modules sys.path.append('...
bsd-3-clause
dancingdan/tensorflow
tensorflow/contrib/factorization/python/ops/kmeans_test.py
9
21832
# 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
rs2/pandas
pandas/tests/indexes/timedeltas/test_partial_slicing.py
3
1347
import numpy as np import pytest from pandas import Series, timedelta_range import pandas._testing as tm class TestSlicing: def test_partial_slice(self): rng = timedelta_range("1 day 10:11:12", freq="h", periods=500) s = Series(np.arange(len(rng)), index=rng) result = s["5 day":"6 day"] ...
bsd-3-clause
peterwilletts24/Python-Scripts
plot_scripts/Rain/Diurnal/sea_diurnal_rain_plot_domain_constrain_large_domain.py
2
10610
""" Load npy xy, plot and save """ import os, sys import matplotlib matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab! import matplotlib.pyplot as plt import matplotlib.cm as mpl_cm from matplotlib import rc from matplotlib.font_manager import FontProperties from matplotlib import rcPa...
mit
jperla/happynews
model/tlc_ppc.py
1
2120
#!/usr/bin/env python """ Runs PPC on a TLC model I made and graphs them. Copyright (C) 2011 Joseph Perla GNU Affero General Public License. See <http://www.gnu.org/licenses/>. """ import glob import numpy as np import jsondata import ppc if __name__=='__main__': s = 'midterm/mytlc-output-15-%s' ...
agpl-3.0
cauchycui/scikit-learn
sklearn/svm/tests/test_svm.py
116
31653
""" Testing for Support Vector Machine module (sklearn.svm) TODO: remove hard coded numerical results when possible """ import numpy as np import itertools from numpy.testing import assert_array_equal, assert_array_almost_equal from numpy.testing import assert_almost_equal from scipy import sparse from nose.tools im...
bsd-3-clause
jreback/pandas
pandas/tests/io/parser/test_parse_dates.py
1
48127
""" Tests date parsing functionality for all of the parsers defined in parsers.py """ from datetime import date, datetime from io import StringIO from dateutil.parser import parse as du_parse from hypothesis import given, settings, strategies as st import numpy as np import pytest import pytz from pandas._libs.tslib...
bsd-3-clause
boada/HETDEXCluster
analysis/examples/emcee_cosmo.py
1
4356
import numpy as np import emcee from astroML.datasets import generate_mu_z from astroML.cosmology import Cosmology import matplotlib.pyplot as plt #from astLib import astCalc as aca def compute_sigma_level(trace1, trace2, nbins=20): """From a set of traces, bin by number of standard deviations""" L, xbins, yb...
mit
TGM-HIT/eqep-api
eqep/shakemap/shakemap.py
1
6596
import matplotlib.pyplot as plot from eqep.data.earthquake import EarthQuake class ShakeMap: """This class represents a ShakeMap, i.e. a visual representation of interpolated earthquake peak ground velocities in a certain area. It is completely customizable in interpolation algorithm, scale and styling. ...
mit
bgris/ODL_bgris
lib/python3.5/site-packages/scipy/interpolate/fitpack2.py
12
61523
""" fitpack --- curve and surface fitting with splines fitpack is based on a collection of Fortran routines DIERCKX by P. Dierckx (see http://www.netlib.org/dierckx/) transformed to double routines by Pearu Peterson. """ # Created by Pearu Peterson, June,August 2003 from __future__ import division, print_function, abs...
gpl-3.0
andrewnc/scikit-learn
sklearn/datasets/tests/test_rcv1.py
322
2414
"""Test the rcv1 loader. Skipped if rcv1 is not already downloaded to data_home. """ import errno import scipy.sparse as sp import numpy as np from sklearn.datasets import fetch_rcv1 from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing i...
bsd-3-clause
OpenSourcePolicyCenter/taxdata
puf_stage1/stage1.py
1
14312
import pandas as pd import os CUR_PATH = os.path.abspath(os.path.dirname(__file__)) SYR = 2011 # calendar year used to normalize factors BEN_SYR = 2014 # calendar year used just for the benefit start year EYR = 2029 # last calendar year we have data for SOI_YR = 2014 # most recently available SOI estimates # defi...
mit
seckcoder/lang-learn
python/sklearn/examples/linear_model/plot_sgd_separating_hyperplane.py
8
1200
""" ========================================= SGD: Maximum margin separating hyperplane ========================================= Plot the maximum margin separating hyperplane within a two-class separable dataset using a linear Support Vector Machines classifier trained using SGD. """ print __doc__ import numpy as np...
unlicense
ECP-CANDLE/Benchmarks
Pilot1/Uno_UQ/calibration/calibration_HET.py
1
4100
#! /usr/bin/env python from __future__ import division, print_function import pandas as pd import sys import os import pickle import dill lib_path2 = os.path.abspath(os.path.join('..', '..', 'common')) sys.path.append(lib_path2) import candle_keras as candle def read_file(path, filename): df_data = pd.read_cs...
mit
wdurhamh/statsmodels
statsmodels/genmod/generalized_estimating_equations.py
19
97130
""" Procedures for fitting marginal regression models to dependent data using Generalized Estimating Equations. References ---------- KY Liang and S Zeger. "Longitudinal data analysis using generalized linear models". Biometrika (1986) 73 (1): 13-22. S Zeger and KY Liang. "Longitudinal Data Analysis for Discrete and ...
bsd-3-clause
sarahgrogan/scikit-learn
examples/applications/plot_prediction_latency.py
234
11277
""" ================== Prediction Latency ================== This is an example showing the prediction latency of various scikit-learn estimators. The goal is to measure the latency one can expect when doing predictions either in bulk or atomic (i.e. one by one) mode. The plots represent the distribution of the pred...
bsd-3-clause
lht142934/trading-with-python
lib/widgets.py
78
3012
# -*- coding: utf-8 -*- """ A collection of widgets for gui building Copyright: Jev Kuznetsov License: BSD """ from __future__ import division import sys from PyQt4.QtCore import * from PyQt4.QtGui import * import numpy as np from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as Figur...
bsd-3-clause
ljwolf/pysal
pysal/contrib/geotable/ops/tests/test_accessors.py
6
19829
from ....pdio import read_files as rf from .. import _accessors as to_test from .....cg import Point, Chain, Polygon, Rectangle, LineSegment from .....common import pandas, RTOL, ATOL from .....examples import get_path import numpy as np import unittest as ut PANDAS_EXTINCT = pandas is None @ut.skipIf(PANDAS_EXTINCT, ...
bsd-3-clause
raingo/coco-caption
pycocotools/coco.py
5
15190
__author__ = 'tylin' __version__ = '1.0.1' # Interface for accessing the Microsoft COCO dataset. # Microsoft COCO is a large image dataset designed for object detection, # segmentation, and caption generation. pycocotools is a Python API that # assists in loading, parsing and visualizing the annotations in COCO. # Ple...
bsd-2-clause
james4424/nest-simulator
doc/nest_by_example/scripts/one_neuron_with_sine_wave.py
4
1514
# -*- coding: utf-8 -*- # # one_neuron_with_sine_wave.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 t...
gpl-2.0
DSLituiev/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
janusassetallocation/loman
loman/visualization.py
1
4378
import matplotlib as mpl import networkx as nx import pydotplus import six from loman.consts import NodeAttributes, States state_colors = { None: '#ffffff', # xkcd white States.PLACEHOLDER: '#f97306', # xkcd orange States.UNINITIALIZED: '#0343df', # xkcd blue States.STALE: '...
bsd-3-clause
themrmax/scikit-learn
examples/datasets/plot_iris_dataset.py
36
1929
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= The Iris Dataset ========================================================= This data sets consists of 3 different types of irises' (Setosa, Versicolour, and Virginica) petal and sepal length, stored in a 150x4 numpy...
bsd-3-clause
djgagne/scikit-learn
examples/classification/plot_classifier_comparison.py
181
4699
#!/usr/bin/python # -*- coding: utf-8 -*- """ ===================== Classifier comparison ===================== A comparison of a several classifiers in scikit-learn on synthetic datasets. The point of this example is to illustrate the nature of decision boundaries of different classifiers. This should be taken with ...
bsd-3-clause
aledionigi/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
suriyan/ethnicolr
ethnicolr/pred_wiki_name.py
1
4512
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import argparse import pandas as pd import numpy as np from keras.models import load_model from keras.preprocessing import sequence from pkg_resources import resource_filename from .utils import column_exists, find_ngrams, fixup_columns MODELFN = "models/wiki...
mit
derDavidT/sympy
sympy/external/importtools.py
85
7294
"""Tools to assist importing optional external modules.""" from __future__ import print_function, division import sys # Override these in the module to change the default warning behavior. # For example, you might set both to False before running the tests so that # warnings are not printed to the console, or set bo...
bsd-3-clause
pv/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
brean/python-pathfinding
test/csv_pandas_test.py
1
1082
import os import pandas import numpy as np from pathfinding.core.diagonal_movement import DiagonalMovement from pathfinding.core.grid import Grid from pathfinding.finder.a_star import AStarFinder BASE_PATH = os.path.abspath(os.path.dirname(__file__)) CSV_FILE = os.path.join(BASE_PATH, 'csv_file.csv') def _find(matr...
mit
KarchinLab/2020plus
scripts/python/convert_gene_names.py
1
3900
import pandas as pd import numpy as np import csv import argparse import IPython already_converted = {} def parse_arguments(): info = 'Convert gene names to approved HUGO symbol' parser = argparse.ArgumentParser(description=info) help_str = 'Path to HUGO name file' parser.add_argument('-hugo', '--hu...
apache-2.0
hainm/statsmodels
statsmodels/sandbox/tsa/examples/ex_mle_arma.py
33
4587
# -*- coding: utf-8 -*- """ TODO: broken because of changes to arguments and import paths fixing this needs a closer look Created on Thu Feb 11 23:41:53 2010 Author: josef-pktd copyright: Simplified BSD see license.txt """ from __future__ import print_function import numpy as np from numpy.testing import assert_almost...
bsd-3-clause
sarahgrogan/scikit-learn
examples/datasets/plot_iris_dataset.py
283
1928
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= The Iris Dataset ========================================================= This data sets consists of 3 different types of irises' (Setosa, Versicolour, and Virginica) petal and sepal length, stored in a 150x4 numpy...
bsd-3-clause
SkiNgK/RNA-Diagnostico-Diabetes-Mellitus
rnaDiabetesGr3.py
1
15906
# -*- coding: utf-8 -*- from pybrain.supervised.trainers import BackpropTrainer from pybrain.tools.shortcuts import buildNetwork from pybrain.structure import TanhLayer from pybrain.structure import LinearLayer from pybrain.structure import SigmoidLayer from pybrain.datasets import SupervisedDataSet from Tkinter import...
mit
gtoonstra/airflow
airflow/contrib/hooks/salesforce_hook.py
10
12428
# -*- coding: utf-8 -*- # # 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 #...
apache-2.0
nmayorov/scikit-learn
sklearn/cluster/tests/test_hierarchical.py
58
19797
""" Several basic tests for hierarchical clustering procedures """ # Authors: Vincent Michel, 2010, Gael Varoquaux 2012, # Matteo Visconti di Oleggio Castello 2014 # License: BSD 3 clause from tempfile import mkdtemp import shutil from functools import partial import numpy as np from scipy import sparse from...
bsd-3-clause
fmacias64/deap
examples/coev/coop_evol.py
12
6361
# This file is part of DEAP. # # DEAP 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 later version. # # DEAP is distributed ...
lgpl-3.0
dmsuehir/spark-tk
python/sparktk/frame/constructors/import_pandas.py
2
8962
# vim: set encoding=utf-8 # Copyright (c) 2016 Intel 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 License at # #       http://www.apache.org/licenses/LICENSE-2.0 # # Unless require...
apache-2.0
bloyl/mne-python
mne/channels/tests/test_layout.py
4
14417
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Denis Engemann <denis.engemann@gmail.com> # Martin Luessi <mluessi@nmr.mgh.harvard.edu> # Eric Larson <larson.eric.d@gmail.com> # # License: Simplified BSD import copy import os.path as op import numpy as np from numpy.testing im...
bsd-3-clause
karstenw/nodebox-pyobjc
examples/Extended Application/sklearn/examples/model_selection/plot_train_error_vs_test_error.py
1
3385
""" ========================= 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...
mit
jrh154/ChibbarGroup
Phylogeny Scripts/Function_Library.py
2
7275
from Bio import SeqIO, Entrez import pandas as pd import numpy as np from os.path import join, isfile, isdir from os import remove, mkdir, listdir import sys Entrez.email = 'john.hayes@usask.ca' #Reads a CSV file containing accession number, species name, family group, and protein type info #and returns a dictionary ...
mit
ryanpdwyer/hdf5plotter
setup.py
1
1784
#!/usr/bin/env python import os import sys from setuptools import setup # See https://github.com/warner/python-versioneer import versioneer versioneer.VCS = 'git' versioneer.versionfile_source = 'hdf5plotter/_version.py' versioneer.versionfile_build = 'hdf5plotter/_version.py' versioneer.tag_prefix = '' # tags are l...
mit
MuhammedHasan/metabolitics
metabolitics/preprocessing/reaction_diff_transformer.py
1
1692
from sklearn.base import TransformerMixin from sklearn_utils.utils import average_by_label from metabolitics.utils import load_network_model class ReactionDiffTransformer(TransformerMixin): """Scaler reaction by diff""" def __init__(self, network_model="recon2", reference_label='healthy'): self.mode...
gpl-3.0
GoogleCloudPlatform/datacatalog-connectors-rdbms
google-datacatalog-postgresql-connector/tests/google/datacatalog_connectors/postgresql/scrape/metadata_scraper_test.py
1
5796
#!/usr/bin/python # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
apache-2.0
rth/PyAbel
examples/example_hansenlaw_Xe.py
2
2430
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import numpy as np import matplotlib.pyplot as plt import abel import scipy.misc # This example demonstrates Hansen and Law inverse Abel transf...
mit
IamJeffG/geopandas
doc/source/conf.py
1
8075
# -*- coding: utf-8 -*- # # GeoPandas documentation build configuration file, created by # sphinx-quickstart on Tue Oct 15 08:08:14 2013. # # 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. # # A...
bsd-3-clause
jmetzen/scikit-learn
sklearn/cluster/tests/test_birch.py
342
5603
""" Tests for the birch clustering algorithm. """ from scipy import sparse import numpy as np from sklearn.cluster.tests.common import generate_clustered_data from sklearn.cluster.birch import Birch from sklearn.cluster.hierarchical import AgglomerativeClustering from sklearn.datasets import make_blobs from sklearn.l...
bsd-3-clause
lthurlow/Network-Grapher
proj/external/numpy-1.7.0/build/lib.linux-i686-2.7/numpy/core/function_base.py
11
5472
__all__ = ['logspace', 'linspace'] import numeric as _nx from numeric import array def linspace(start, stop, num=50, endpoint=True, retstep=False): """ Return evenly spaced numbers over a specified interval. Returns `num` evenly spaced samples, calculated over the interval [`start`, `stop` ]. Th...
mit
aparna29/Implementation-of-Random-Exponential-Marking-REM-in-ns-3
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
yarikoptic/pystatsmodels
statsmodels/sandbox/regression/kernridgeregress_class.py
39
7941
'''Kernel Ridge Regression for local non-parametric regression''' import numpy as np from scipy import spatial as ssp from numpy.testing import assert_equal import matplotlib.pylab as plt def plt_closeall(n=10): '''close a number of open matplotlib windows''' for i in range(n): plt.close() def kernel_rbf(x,...
bsd-3-clause
jlegendary/pybrain
examples/rl/environments/shipsteer/shipbench_sde.py
26
3454
from __future__ import print_function #!/usr/bin/env python ######################################################################### # Reinforcement Learning with SPE on the ShipSteering Environment # # Requirements: # pybrain (tested on rev. 1195, ship env rev. 1202) # Synopsis: # shipbenchm.py [<True|False> [lo...
bsd-3-clause
manashmndl/scikit-learn
examples/exercises/plot_cv_digits.py
232
1206
""" ============================================= Cross-validation on Digits Dataset Exercise ============================================= A tutorial exercise using Cross-validation with an SVM on the Digits dataset. This exercise is used in the :ref:`cv_generators_tut` part of the :ref:`model_selection_tut` section...
bsd-3-clause
boomsbloom/dtm-fmri
DTM/for_gensim/lib/python2.7/site-packages/sklearn/utils/multiclass.py
41
14732
# Author: Arnaud Joly, Joel Nothman, Hamzeh Alsalhi # # License: BSD 3 clause """ Multi-class / multi-label utility function ========================================== """ from __future__ import division from collections import Sequence from itertools import chain from scipy.sparse import issparse from scipy.sparse....
mit
zfrenchee/pandas
pandas/util/_decorators.py
2
10870
from pandas.compat import callable, signature, PY2 from pandas._libs.properties import cache_readonly # noqa import inspect import types import warnings from textwrap import dedent, wrap from functools import wraps, update_wrapper def deprecate(name, alternative, alt_name=None, klass=None, stacklevel=2...
bsd-3-clause
modulesio/antikyth
bullet3/examples/pybullet/testrender_np.py
1
1218
import numpy as np import matplotlib.pyplot as plt import pybullet import time pybullet.connect(pybullet.DIRECT) pybullet.loadURDF("r2d2.urdf") camTargetPos = [0,0,0] cameraUp = [0,0,1] cameraPos = [1,1,1] yaw = 40 pitch = 10.0 roll=0 upAxisIndex = 2 camDistance = 4 pixelWidth = 1920 pixelHeight = 1080 nearPlane = 0...
mit
bhargavasana/activitysim
activitysim/defaults/models/mandatory_tour_frequency.py
1
2109
import os import orca import pandas as pd from activitysim import activitysim as asim from .util.mandatory_tour_frequency import process_mandatory_tours """ This model predicts the frequency of making mandatory trips (see the alternatives above) - these trips include work and school in some combination. """ @orca....
agpl-3.0
klocey/Emergence
tools/SADfits/SADfits.py
9
3639
from __future__ import division import matplotlib.pyplot as plt import sys import os from random import shuffle import numpy as np ########### PATHS ############################################################## mydir = os.path.expanduser("~/GitHub/residence-time") tools = os.path.expanduser(mydir + "/tools") sys.p...
mit
wanggang3333/scikit-learn
examples/cluster/plot_agglomerative_clustering_metrics.py
402
4492
""" Agglomerative clustering with different metrics =============================================== Demonstrates the effect of different metrics on the hierarchical clustering. The example is engineered to show the effect of the choice of different metrics. It is applied to waveforms, which can be seen as high-dimens...
bsd-3-clause
Dexhub/MTX
util/stats/output.py
90
7981
# Copyright (c) 2005-2006 The Regents of The University of Michigan # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: redistributions of source code must retain the above copyright # notice, this ...
bsd-3-clause
nhejazi/scikit-learn
sklearn/metrics/ranking.py
2
31015
"""Metrics to assess performance on classification task given scores Functions named as ``*_score`` return a scalar value to maximize: the higher the better Function named as ``*_error`` or ``*_loss`` return a scalar value to minimize: the lower the better """ # Authors: Alexandre Gramfort <alexandre.gramfort@inria....
bsd-3-clause
MechCoder/scikit-learn
sklearn/decomposition/tests/test_incremental_pca.py
43
10272
"""Tests for Incremental PCA.""" import numpy as np from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_raises from sklearn import datasets from sklearn.decomposition import PCA, IncrementalPCA iris = datasets.load...
bsd-3-clause