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
nkmk/python-snippets
notebook/pandas_ohlc_candlestick_chart.py
1
5049
import pandas as pd import matplotlib.pyplot as plt import matplotlib.dates as mdates import mpl_finance df_org = pd.read_csv('data/src/aapl_2015_2019.csv', index_col=0, parse_dates=True)['2017'] print(df_org) # open high low close volume # 2017-01-03 115.80 116.3300 114.760 116.15 28...
mit
rsivapr/scikit-learn
sklearn/tree/tests/test_export.py
3
2897
""" Testing for export functions of decision trees (sklearn.tree.export). """ from numpy.testing import assert_equal from nose.tools import assert_raises from sklearn.tree import DecisionTreeClassifier from sklearn.tree import export_graphviz from sklearn.externals.six import StringIO # toy sample X = [[-2, -1], [-1...
bsd-3-clause
eickenberg/scikit-learn
sklearn/feature_selection/tests/test_from_model.py
244
1593
import numpy as np import scipy.sparse as sp from nose.tools import assert_raises, assert_true from sklearn.utils.testing import assert_less from sklearn.utils.testing import assert_greater from sklearn.datasets import load_iris from sklearn.linear_model import LogisticRegression from sklearn.linear_model import SGD...
bsd-3-clause
posborne/Anvil
anvil/examples/commit_histogram.py
2
1787
# Copyright (c) 2012 Paul Osborne <osbpau@gmail.com> # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, mer...
mit
natasasdj/OpenWPM
analysis_parallel/08_third-party_images.py
1
2769
import sqlite3 import os import pandas as pd # on how many pages appear third-party/one-pixel/zero-size images # on how many homesites appear third party/one-pixel/zero-size images # on how many first links appear third-party/one-pixel/zero-size images # on how many domains appear third party/one-pixel/zero-size image...
gpl-3.0
tcrossland/time_series_prediction
ann/scenario.py
1
2422
import time import matplotlib.pyplot as plt import numpy as np class Config: def __init__(self, time_series, look_back=6, batch_size=1, topology=None, validation_split=0.3, include_index=False, activation='tanh', optimizer='adam'): self.time_series = time_series self.look_back = ...
mit
manjunaths/tensorflow
tensorflow/contrib/learn/python/learn/learn_io/pandas_io.py
18
6444
# 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
Sibada/VIC_Hime
Hime/calibrater.py
1
13255
#!/usr/bin/env python # -*- coding: utf-8 -*- import copy from collections import OrderedDict from datetime import datetime import numpy as np import pandas as pd from Hime import log from Hime.uh_creater import load_rout_data from Hime.routing import confluence, gather_to_month, gather_to_year from Hime.statistic i...
gpl-3.0
shadowleaves/deep_learning
theano/rnn_minibatch.py
1
30441
""" Vanilla RNN Parallelizes scan over sequences by using mini-batches. @author Graham Taylor """ import numpy as np import theano import theano.tensor as T # from sklearn.base import BaseEstimator import logging import time import os import datetime import cPickle as pickle from collections import OrderedDict logger ...
mit
naoyak/Agile_Data_Code_2
ch07/train_sklearn_model.py
1
5282
import sys, os, re sys.path.append("lib") import utils import numpy as np import sklearn import iso8601 import datetime print("Imports loaded...") # Load and check the size of our training data. May take a minute. print("Original JSON file size: {:,} Bytes".format(os.path.getsize("data/simple_flight_delay_features.js...
mit
daniel-vainsencher/regularized_weighting
src/simpleInterface.py
1
6881
from numpy import array, inf, ones, zeros import matplotlib.pyplot as plt from sklearn.svm import SVC #from sklearn.metrics import zero_one_score import time import alternatingAlgorithms as aa import weightedModelTypes as wmt from minL2PenalizedLossOverSimplex import penalizedMultipleWeightedLoss2, weightsForLosses, w...
bsd-2-clause
endangeredoxen/pywebify
setup.py
1
4007
"""A setuptools based setup module. See: https://packaging.python.org/en/latest/distributing.html https://github.com/pypa/sampleproject """ # Always prefer setuptools over distutils from setuptools import setup, find_packages # To use a consistent encoding from codecs import open from os import path here = path.abspa...
gpl-2.0
berkeley-stat222/mousestyles
mousestyles/path_diversity/path_index.py
3
2301
from __future__ import (absolute_import, division, print_function, unicode_literals) import numpy as np def path_index(movement, stop_threshold, min_path_length): r""" Return a list object containing start and end indices for a specific movement. Each element in the list is a ...
bsd-2-clause
glouppe/scikit-learn
examples/applications/topics_extraction_with_nmf_lda.py
4
3761
""" ======================================================================================= Topic extraction with Non-negative Matrix Factorization and Latent Dirichlet Allocation ======================================================================================= This is an example of applying Non-negative Matrix ...
bsd-3-clause
reychil/project-alpha-1
code/utils/scripts/multi_regression_script.py
1
7291
# multi_regression_script.py # In this file we will be creating multiple regressions using the the glm # function. Moreover, the features added with be: seperating the conditions # from each other (i.e. x_1 = cond1 HRF, x_2 = cond2 HRF, and x_3 = cond3 HRF. # I will be running it with np.convolve and convolution_spe...
bsd-3-clause
rhyolight/nupic.research
projects/wavelet_dataAggregation/runDataAggregationExperiment.py
11
21206
from os.path import isfile, join, exists import pandas as pd import numpy as np from scipy import signal import numpy.matlib import csv import os import time os.environ['TZ'] = 'GMT' time.tzset() display = True if display: import matplotlib.pyplot as plt plt.close('all') plt.ion() def plotWaveletPower(sig, cw...
gpl-3.0
crscardellino/dnnwsd
dnnwsd/pipeline/semisupervised.py
1
5597
# -*- coding: utf-8 -*- import logging import os from copy import deepcopy from sklearn import linear_model, tree from ..corpus import sensem, semeval, unannotated from ..experiment import results, semisupervised from ..model import mlp from ..processor import bowprocessor, vecprocessor from ..utils.setup_logging im...
bsd-3-clause
tskisner/pytoast
src/python/tests/ops_dipole.py
1
7665
# Copyright (c) 2015-2018 by the parties listed in the AUTHORS file. # All rights reserved. Use of this source code is governed by # a BSD-style license that can be found in the LICENSE file. from ..mpi import MPI from .mpi import MPITestCase import sys import os import numpy as np import numpy.testing as nt impor...
bsd-2-clause
cybernet14/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
mtb0/flightmodel
src/download/get_files.py
1
2224
#!/usr/bin/env python """Download Latitude/Longitude information and Flight time information from the Bureau of Transportation Statistics website, using wget.""" import os import pandas as pd import tempfile URL='http://tsdata.bts.gov/' LATLONG='187806114_T_MASTER_CORD' FLIGHT='On_Time_On_Time_Performance' def get_...
mit
LiaoPan/blaze
blaze/compute/tests/test_numpy_compute.py
3
16537
from __future__ import absolute_import, division, print_function import pytest import numpy as np import pandas as pd from datetime import datetime, date from blaze.compute.core import compute, compute_up from blaze.expr import symbol, by, exp, summary, Broadcast, join, concat from blaze import sin from odo import i...
bsd-3-clause
jorge2703/scikit-learn
sklearn/covariance/graph_lasso_.py
127
25626
"""GraphLasso: sparse inverse covariance estimation with an l1-penalized estimator. """ # Author: Gael Varoquaux <gael.varoquaux@normalesup.org> # License: BSD 3 clause # Copyright: INRIA import warnings import operator import sys import time import numpy as np from scipy import linalg from .empirical_covariance_ im...
bsd-3-clause
joshloyal/scikit-learn
examples/cluster/plot_ward_structured_vs_unstructured.py
320
3369
""" =========================================================== Hierarchical clustering: structured vs unstructured ward =========================================================== Example builds a swiss roll dataset and runs hierarchical clustering on their position. For more information, see :ref:`hierarchical_clus...
bsd-3-clause
Lab603/PicEncyclopedias
jni-build/jni-build/jni/include/tensorflow/contrib/learn/python/learn/tests/dataframe/feeding_functions_test.py
30
4777
# 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...
mit
whitews/dpconverge
test_dp_3params.py
1
1245
from dpconverge.data_set import DataSet import numpy as np from sklearn.datasets.samples_generator import make_blobs n_features = 3 points_per_feature = 100 centers = [[2, 2, 1], [2, 4, 2], [4, 2, 3], [4, 4, 4]] ds = DataSet(parameter_count=n_features) rnd_state = np.random.RandomState() rnd_state.seed(3) for i, ce...
bsd-3-clause
blbradley/subset-selector
subset_selector/selector.py
1
3200
import numpy as np import matplotlib import matplotlib.pyplot as plt from matplotlib.backends.backend_nbagg import NavigationIPy, FigureManagerNbAgg BUTTONS = ('Home', 'Back', 'Forward', 'Download') default_facecolor = matplotlib.rcParams['axes.facecolor'] def on_click(event): if event.inaxes and event.button ==...
mit
Averroes/statsmodels
statsmodels/sandbox/survival2.py
35
17924
#Kaplan-Meier Estimator import numpy as np import numpy.linalg as la import matplotlib.pyplot as plt from scipy import stats from statsmodels.iolib.table import SimpleTable class KaplanMeier(object): """ KaplanMeier(...) KaplanMeier(data, endog, exog=None, censoring=None) Create an object of...
bsd-3-clause
snnn/tensorflow
tensorflow/contrib/distributions/python/ops/mixture.py
22
21121
# 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
zhoukekestar/drafts
2020-10~12/2020-12-13-python/k-means.py
1
2941
import matplotlib.pyplot as plt import numpy as np import random pointsA = np.random.normal(loc=[40, 60], scale=15, size=[200, 2]) plt.scatter(pointsA.T[0], pointsA.T[1], marker='o', label="A") pointsB = np.random.normal(loc=[80, 100], scale=12, size=[100, 2]) plt.scatter(pointsB.T[0], pointsB.T[1], marker='^', labe...
mit
pombredanne/metamorphosys-desktop
metamorphosys/META/models/DynamicsTeam/RISoT/post_processing/common/post_processing_class.py
18
28308
# Copyright (C) 2013-2015 MetaMorph Software, Inc # Permission is hereby granted, free of charge, to any person obtaining a # copy of this data, including any software or models in source or binary # form, as well as any drawings, specifications, and documentation # (collectively "the Data"), to deal in the Data ...
mit
with-git/tensorflow
tensorflow/python/estimator/inputs/queues/feeding_queue_runner_test.py
116
5164
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
apache-2.0
luminescence/PolyLibScan
helpers/msms.py
1
13918
import pathlib2 as pl import os import subprocess as sp import tempfile import numpy as np import pandas as pd import collections as col import Bio.PDB as PDB import PolyLibScan.Database.db as DB class HydrophobicParameterisation(object): def __init__(self, pdb_path, pdb_to_xyzrn=None, atmty...
mit
chrisburr/scikit-learn
sklearn/feature_selection/tests/test_feature_select.py
103
22297
""" 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 sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_raises...
bsd-3-clause
yyjiang/scikit-learn
sklearn/tree/tree.py
113
34767
""" This module gathers tree-based methods, including decision, regression and randomized trees. Single and multi-output problems are both handled. """ # Authors: Gilles Louppe <g.louppe@gmail.com> # Peter Prettenhofer <peter.prettenhofer@gmail.com> # Brian Holt <bdholt1@gmail.com> # Noel Da...
bsd-3-clause
idealabasu/code_pynamics
python/pynamics_examples/in_development/pendulum_script_mode.py
1
2823
# -*- coding: utf-8 -*- """ Written by Daniel M. Aukes Email: danaukes<at>gmail.com Please see LICENSE for full license. """ import pynamics from pynamics.frame import Frame from pynamics.variable_types import Differentiable,Constant from pynamics.system import System from pynamics.body import Body from pynamics.dyadi...
mit
RMKD/networkx
networkx/convert.py
22
13215
"""Functions to convert NetworkX graphs to and from other formats. The preferred way of converting data to a NetworkX graph is through the graph constuctor. The constructor calls the to_networkx_graph() function which attempts to guess the input type and convert it automatically. Examples -------- Create a graph wit...
bsd-3-clause
lancezlin/ml_template_py
lib/python2.7/site-packages/pandas/util/doctools.py
9
6779
import numpy as np import pandas as pd import pandas.compat as compat class TablePlotter(object): """ Layout some DataFrames in vertical/horizontal layout for explanation. Used in merging.rst """ def __init__(self, cell_width=0.37, cell_height=0.25, font_size=7.5): self.cell_width = cell_...
mit
robmarano/nyu-python
course-2/session-7/pandas/df_basics.py
1
2677
#!/usr/bin/env python3 try: # for Python 2.x import StringIO except: # for Python 3.x import io import csv import pandas as pd import numpy as np import matplotlib.pyplot as plt import re # define data csv_input = """timestamp,title,reqid 2016-07-23 11:05:08,SVP,2356556-AS 2016-12-12 01:23:33,VP,556...
mit
nmayorov/scikit-learn
examples/svm/plot_svm_nonlinear.py
268
1091
""" ============== Non-linear SVM ============== Perform binary classification using non-linear SVC with RBF kernel. The target to predict is a XOR of the inputs. The color map illustrates the decision function learned by the SVC. """ print(__doc__) import numpy as np import matplotlib.pyplot as plt from sklearn imp...
bsd-3-clause
Nyker510/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
neale/CS-program
434-MachineLearning/final_project/linearClassifier/sklearn/datasets/__init__.py
72
3807
""" The :mod:`sklearn.datasets` module includes utilities to load datasets, including methods to load and fetch popular reference datasets. It also features some artificial data generators. """ from .base import load_diabetes from .base import load_digits from .base import load_files from .base import load_iris from ....
unlicense
ma-compbio/SPEID
pairwise/read_FIMO_results.py
2
5408
import numpy as np import csv from sklearn.metrics import average_precision_score from keras.optimizers import Adam # needed to compile prediction model import h5py import load_data_pairs as ld # my own scripts for loading data import build_small_model as bm import util fimo_root = '/home/sss1/Desktop/projects/DeepInt...
gpl-3.0
neale/CS-program
434-MachineLearning/final_project/linearClassifier/sklearn/semi_supervised/label_propagation.py
9
15941
# coding=utf8 """ Label propagation in the context of this module refers to a set of semisupervised classification algorithms. In the high level, these algorithms work by forming a fully-connected graph between all points given and solving for the steady-state distribution of labels at each point. These algorithms per...
unlicense
vitaly-krugl/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/backends/backend_gtkagg.py
70
4184
""" Render to gtk from agg """ from __future__ import division import os import matplotlib from matplotlib.figure import Figure from matplotlib.backends.backend_agg import FigureCanvasAgg from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK, FigureCanvasGTK,\ show, draw_if_interactive,\ error_ms...
agpl-3.0
BhallaLab/moose-examples
tutorials/ExcInhNet/ExcInhNet_Ostojic2014_Brunel2000_brian2.py
2
8226
''' The LIF network is based on: Ostojic, S. (2014). Two types of asynchronous activity in networks of excitatory and inhibitory spiking neurons. Nat Neurosci 17, 594-600. Key parameter to change is synaptic coupling J (mV). Tested with Brian 1.4.1 Written by Aditya Gilra, CAMP 2014, Bangalore, 20 June, 2014. Upd...
gpl-2.0
BlueFern/DBiharMesher
util/PlotColumn2D.py
1
2787
# -*- coding: utf-8 -*- """ Read SMC Ca2+ values from a line of cells in temporal series and produce a 2D plot """ import re import os import vtk import numpy import matplotlib.pyplot as plt print 'Importing ', __file__ def tryInt(s): try: return int(s) except: return s def alphaNumKey(s): ...
gpl-2.0
mohittahiliani/PIE-ns3
src/flow-monitor/examples/wifi-olsr-flowmon.py
108
7439
# -*- Mode: Python; -*- # Copyright (c) 2009 INESC Porto # # 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, #...
gpl-2.0
vicky2135/lucious
oscar/lib/python2.7/site-packages/IPython/core/tests/test_pylabtools.py
12
7550
"""Tests for pylab tools module. """ # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. from __future__ import print_function from io import UnsupportedOperation, BytesIO import matplotlib matplotlib.use('Agg') from matplotlib.figure import Figure from nose import ...
bsd-3-clause
anhaidgroup/py_entitymatching
py_entitymatching/matcher/logregmatcher.py
1
1284
""" This module contains the functions for Logistic Regression classifier. """ from py_entitymatching.matcher.mlmatcher import MLMatcher from sklearn.linear_model import LogisticRegression from py_entitymatching.matcher.matcherutils import get_ts class LogRegMatcher(MLMatcher): """ Logistic Regression matcher....
bsd-3-clause
zihua/scikit-learn
examples/manifold/plot_compare_methods.py
31
4051
""" ========================================= Comparison of Manifold Learning methods ========================================= An illustration of dimensionality reduction on the S-curve dataset with various manifold learning methods. For a discussion and comparison of these algorithms, see the :ref:`manifold module...
bsd-3-clause
Lawrence-Liu/scikit-learn
examples/cluster/plot_kmeans_assumptions.py
270
2040
""" ==================================== Demonstration of k-means assumptions ==================================== This example is meant to illustrate situations where k-means will produce unintuitive and possibly unexpected clusters. In the first three plots, the input data does not conform to some implicit assumptio...
bsd-3-clause
esquishesque/musical-potato
analysis_bulk.py
1
14383
import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import numpy as np import sys import math #full data frame with all data df=pd.read_excel('first survey - English final (Responses).xlsx',sheetname=5,skiprows=1,keep_default_na=False) #df=pd.read_excel('survey_test.xls',sheetname=1) #get the c...
gpl-3.0
dcolombo/FilFinder
examples/paper_figures/match_resolution.py
3
7990
# Licensed under an MIT open source license - see LICENSE ''' Check resolution effects of masking process. Degrade an image to match the resolution of a more distant one, then compare the outputs. ''' from fil_finder import fil_finder_2D import numpy as np from astropy.io.fits import getdata from astropy import convo...
mit
ua-snap/downscale
old/bin/old/cld_cru_ts31_downscaling.py
2
11324
# # # # Current implementation of the cru ts31 (ts32) delta downscaling procedure # # Author: Michael Lindgren (malindgren@alaska.edu) # # # import numpy as np def write_gtiff( output_arr, template_meta, output_filename, compress=True ): ''' DESCRIPTION: ------------ output a GeoTiff given a numpy ndarray, rasterio...
mit
crystalrood/piggie
public/test_scripts/updating_status_mongo.py
1
1334
# this test file takes an encoded emai, decodes it, parese out order information and saves it to the database # also changes the status of the messages db from "need to scrape" to "scraped" # # # #required encoding for scraping, otherwise defaults to unicode and screws things up from bs4 import BeautifulSoup import req...
mit
great-expectations/great_expectations
tests/core/test_expectation_suite.py
1
17469
import datetime from copy import copy, deepcopy from typing import Any, Dict, List import pytest from ruamel.yaml import YAML from great_expectations.core.expectation_configuration import ExpectationConfiguration from great_expectations.core.expectation_suite import ExpectationSuite from great_expectations.util impor...
apache-2.0
carefree0910/MachineLearning
b_NaiveBayes/Original/GaussianNB.py
1
4093
import os import sys root_path = os.path.abspath("../../") if root_path not in sys.path: sys.path.append(root_path) import matplotlib.pyplot as plt from b_NaiveBayes.Original.Basic import * from b_NaiveBayes.Original.MultinomialNB import MultinomialNB from Util.Util import DataUtil class Gaussian...
mit
mindw/shapely
docs/code/polygon2.py
6
1798
from matplotlib import pyplot from matplotlib.patches import Circle from shapely.geometry import Polygon from descartes.patch import PolygonPatch from figures import SIZE COLOR = { True: '#6699cc', False: '#ff3333' } def v_color(ob): return COLOR[ob.is_valid] def plot_coords(ax, ob): x, y = ob....
bsd-3-clause
FireElementalNE/RetroColorAnalysis
scatterplots/scatter_plot.py
1
1813
import os import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import globals.global_values as global_values class ScatterPlot: def __init__(self, cl, _dirs, _is_agg): ''' init a scatter plot :param cl: the list of colors :param _dirs: the dirs structure ...
gpl-2.0
trichter/sito
bin/noise/noise_s_final_autocorr1.py
1
4932
#!/usr/bin/env python # by TR from obspy.core import UTCDateTime as UTC from sito.data import IPOC from sito.noisexcorr import (prepare, get_correlations, plotXcorrs, noisexcorrf, stack) from sito import util import matplotlib.pyplot as plt from sito.stream import read from multiprocessing ...
mit
mjgrav2001/scikit-learn
examples/tree/plot_tree_regression_multioutput.py
206
1800
""" =================================================================== Multi-output Decision Tree Regression =================================================================== An example to illustrate multi-output regression with decision tree. The :ref:`decision trees <tree>` is used to predict simultaneously the ...
bsd-3-clause
NixaSoftware/CVis
venv/lib/python2.7/site-packages/pandas/tests/series/test_asof.py
11
5289
# coding=utf-8 import pytest import numpy as np from pandas import (offsets, Series, notna, isna, date_range, Timestamp) import pandas.util.testing as tm from .common import TestData class TestSeriesAsof(TestData): def test_basic(self): # array or list or dates N = 50 ...
apache-2.0
jkarnows/scikit-learn
sklearn/cluster/tests/test_spectral.py
262
7954
"""Testing for Spectral Clustering methods""" from sklearn.externals.six.moves import cPickle dumps, loads = cPickle.dumps, cPickle.loads import numpy as np from scipy import sparse from sklearn.utils import check_random_state from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_a...
bsd-3-clause
manifoldai/merf
merf/merf.py
1
15249
""" Mixed Effects Random Forest model. """ import logging import numpy as np import pandas as pd from sklearn.ensemble import RandomForestRegressor from sklearn.exceptions import NotFittedError logger = logging.getLogger(__name__) class MERF(object): """ This is the core class to instantiate, train, and pre...
mit
heli522/scikit-learn
sklearn/linear_model/tests/test_least_angle.py
98
20870
from nose.tools import assert_equal import numpy as np from scipy import linalg from sklearn.cross_validation import train_test_split from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_less from sklearn.utils.testing impor...
bsd-3-clause
etkirsch/scikit-learn
examples/gaussian_process/plot_gp_regression.py
253
4054
#!/usr/bin/python # -*- coding: utf-8 -*- r""" ========================================================= Gaussian Processes regression: basic introductory example ========================================================= A simple one-dimensional regression exercise computed in two different ways: 1. A noise-free cas...
bsd-3-clause
wesm/statsmodels
scikits/statsmodels/sandbox/examples/thirdparty/ex_ratereturn.py
1
4385
# -*- coding: utf-8 -*- """Playing with correlation of DJ-30 stock returns this uses pickled data that needs to be created with findow.py to see graphs, uncomment plt.show() Created on Sat Jan 30 16:30:18 2010 Author: josef-pktd """ import numpy as np import matplotlib.finance as fin import matplotlib.pyplot as plt...
bsd-3-clause
johnmgregoire/PythonCompositionPlots
quaternary_FOM_stackedtern5.py
1
2984
import matplotlib.cm as cm import numpy import pylab import operator, copy, os #pylab.rc('font',**{'family':'serif''serif':['Times New Roman']}) #pylab.rcParams['font.family']='serif' #pylab.rcParams['font.serif']='Times New Roman' pylab.rc('font', family='serif', serif='Times New Roman') #os.chdir('C:/Users/Gregoire...
bsd-3-clause
ywcui1990/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/backends/backend_gtkcairo.py
69
2207
""" GTK+ Matplotlib interface using cairo (not GDK) drawing operations. Author: Steve Chaplin """ import gtk if gtk.pygtk_version < (2,7,0): import cairo.gtk from matplotlib.backends import backend_cairo from matplotlib.backends.backend_gtk import * backend_version = 'PyGTK(%d.%d.%d) ' % gtk.pygtk_version + \ ...
agpl-3.0
jshiv/turntable
test/lib/python2.7/site-packages/scipy/spatial/tests/test__plotutils.py
71
1463
from __future__ import division, print_function, absolute_import from numpy.testing import dec, assert_, assert_array_equal try: import matplotlib matplotlib.rcParams['backend'] = 'Agg' import matplotlib.pyplot as plt has_matplotlib = True except: has_matplotlib = False from scipy.spatial import ...
mit
mrshu/scikit-learn
examples/linear_model/plot_logistic.py
5
1389
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Logit function ========================================================= Show in the plot is how the logistic regression would, in this synthetic dataset, classify values as either 0 or 1, i.e. class one or two, us...
bsd-3-clause
trmznt/fatools
fatools/scripts/facmd.py
2
17741
import sys, argparse, yaml, csv, transaction from fatools.lib.utils import cout, cerr, get_dbhandler, set_verbosity from fatools.lib import params from fatools.lib.const import assaystatus, peaktype from fatools.lib.fautil import algo def init_argparser(parser=None): if parser: p = parser else: ...
lgpl-3.0
vmAggies/omniture-master
build/lib/omniture/query.py
2
16229
# encoding: utf-8 from __future__ import absolute_import import time from copy import copy, deepcopy import functools from dateutil.relativedelta import relativedelta import json import logging import sys import pandas as pd import io import requests from .elements import Value from . import reports from . import uti...
mit
borismarin/genesis2.4gamma
Scripts/gpython-tools/plotVm.py
1
2028
#!/usr/bin/env python # plotVm ver 0.5 - a command line utility to plot a wildcarded argument # list of files containing membrane potential data, and plots them in # different colors on the same axes import sys, os import matplotlib.pyplot as plt import numpy as np def plot_file(file,format): print 'Plotting %s'...
gpl-2.0
scienceopen/CVutils
DemoMedianFilter.py
1
1893
#!/usr/bin/env python import cv2 import numpy as np from skimage.util import random_noise from matplotlib.pyplot import figure, show from typing import Tuple def gen_patterns( x: int, y: int, dtype=np.uint8, noise: float = 0.0 ) -> Tuple[np.ndarray, np.ndarray]: if dtype == np.uint8: V = 255 elif...
mit
koobonil/Boss2D
Boss2D/addon/tensorflow-1.2.1_for_boss/tensorflow/contrib/learn/python/learn/estimators/kmeans_test.py
44
19373
# 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...
mit
shikhardb/scikit-learn
examples/tree/plot_tree_regression.py
40
1470
""" =================================================================== Decision Tree Regression =================================================================== A 1D regression with decision tree. The :ref:`decision trees <tree>` is used to fit a sine curve with addition noisy observation. As a result, it learns ...
bsd-3-clause
gfyoung/pandas
pandas/tests/arrays/boolean/test_construction.py
6
12857
import numpy as np import pytest import pandas as pd import pandas._testing as tm from pandas.arrays import BooleanArray from pandas.core.arrays.boolean import coerce_to_array def test_boolean_array_constructor(): values = np.array([True, False, True, False], dtype="bool") mask = np.array([False, False, Fals...
bsd-3-clause
sandeepdsouza93/TensorFlow-15712
tensorflow/contrib/learn/python/learn/experiment.py
5
16349
# 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
aflaxman/scikit-learn
sklearn/feature_extraction/dict_vectorizer.py
16
12486
# Authors: Lars Buitinck # Dan Blanchard <dblanchard@ets.org> # License: BSD 3 clause from array import array from collections import Mapping from operator import itemgetter import numpy as np import scipy.sparse as sp from ..base import BaseEstimator, TransformerMixin from ..externals import six from ..ext...
bsd-3-clause
kyleabeauchamp/HMCNotes
code/correctness/june11/test_various_hmc.py
1
2454
import lb_loader import pandas as pd import simtk.openmm.app as app import numpy as np import simtk.openmm as mm from simtk import unit as u from openmmtools import hmc_integrators, testsystems precision = "mixed" sysname = "chargedswitchedaccurateljbox" system, positions, groups, temperature, timestep, langevin_tim...
gpl-2.0
leesavide/pythonista-docs
Documentation/matplotlib/examples/event_handling/lasso_demo.py
9
2365
""" Show how to use a lasso to select a set of points and get the indices of the selected points. A callback is used to change the color of the selected points This is currently a proof-of-concept implementation (though it is usable as is). There will be some refinement of the API. """ from matplotlib.widgets import...
apache-2.0
Mohitsharma44/citibike-challenge
citibike-challenge-aio.py
2
3386
import pylab as plt import pandas as pd import numpy as np import datetime as dt def datestr_as_datetime(dstr): #2014-01-27 12:28:45 dstr=dstr.split() y,mo,day=dstr[0].split('-') hh,mm,ss=dstr[1].split(':') return dt.datetime(int(y),int(mo),int(day),int(hh),int(mm),int(ss)) cbs=pd.read_csv("./citi...
mit
gaoce/TimeVis
setup.py
1
1191
from __future__ import print_function import os from setuptools import setup # Utility function to read the README file. def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() # Setup # 1. zip_safe needs to be False since we need access to templates setup( name="TimeVis", v...
mit
larsoner/mne-python
mne/decoding/tests/test_transformer.py
7
9311
# Author: Mainak Jas <mainak@neuro.hut.fi> # Romain Trachel <trachelr@gmail.com> # # License: BSD (3-clause) import os.path as op import numpy as np import pytest from numpy.testing import (assert_array_equal, assert_array_almost_equal, assert_allclose, assert_equal) from mne impor...
bsd-3-clause
DR08/mxnet
example/svm_mnist/svm_mnist.py
44
4094
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
apache-2.0
mikehankey/fireball_camera
analyze-stacks.py
1
55222
#!/usr/bin/python3 # next steps. save off a cache of the diffs,so we can save time on multiple re-runs. # do a crop cnt confirm. # script to make master stacks per night and hour from the 1 minute stacks from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas from matplotlib.figure import Figur...
gpl-3.0
unnikrishnankgs/va
venv/lib/python3.5/site-packages/matplotlib/patheffects.py
10
14296
""" Defines classes for path effects. The path effects are supported in :class:`~matplotlib.text.Text`, :class:`~matplotlib.lines.Line2D` and :class:`~matplotlib.patches.Patch`. """ from __future__ import (absolute_import, division, print_function, unicode_literals) import six from matplotlib...
bsd-2-clause
bundgus/python-playground
matplotlib-playground/examples/pylab_examples/plotfile_demo.py
1
1195
import matplotlib.pyplot as plt import numpy as np import matplotlib.cbook as cbook fname = cbook.get_sample_data('msft.csv', asfileobj=False) fname2 = cbook.get_sample_data('data_x_x2_x3.csv', asfileobj=False) # test 1; use ints plt.plotfile(fname, (0, 5, 6)) # test 2; use names plt.plotfile(fname, ('date', 'volum...
mit
jungla/ICOM-fluidity-toolbox
Detectors/plot_FSLE_v.py
1
2388
#!~/python import fluidity_tools import matplotlib as mpl mpl.use('ps') import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import myfun import numpy as np import pyvtk import vtktools import copy import os exp = 'r_3k_B_1F0_r' filename = './ring_checkpoint.detectors' filename2 = '/tamay2/mensa/f...
gpl-2.0
abhisg/scikit-learn
benchmarks/bench_isotonic.py
268
3046
""" Benchmarks of isotonic regression performance. We generate a synthetic dataset of size 10^n, for n in [min, max], and examine the time taken to run isotonic regression over the dataset. The timings are then output to stdout, or visualized on a log-log scale with matplotlib. This alows the scaling of the algorith...
bsd-3-clause
dssg/wikienergy
disaggregator/build/pandas/doc/sphinxext/numpydoc/tests/test_docscrape.py
39
18326
# -*- encoding:utf-8 -*- from __future__ import division, absolute_import, print_function import sys, textwrap from numpydoc.docscrape import NumpyDocString, FunctionDoc, ClassDoc from numpydoc.docscrape_sphinx import SphinxDocString, SphinxClassDoc from nose.tools import * if sys.version_info[0] >= 3: sixu = la...
mit
andrewnc/scikit-learn
sklearn/linear_model/tests/test_logistic.py
59
35368
import numpy as np import scipy.sparse as sp from scipy import linalg, optimize, sparse import scipy from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_equal from...
bsd-3-clause
glouppe/scikit-learn
sklearn/linear_model/tests/test_ridge.py
19
26553
import numpy as np import scipy.sparse as sp from scipy import linalg from itertools import product from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_equal from sklearn...
bsd-3-clause
lucidfrontier45/scikit-learn
examples/linear_model/plot_logistic_path.py
7
1170
#!/usr/bin/env python """ ================================= Path with L1- Logistic Regression ================================= Computes path on IRIS dataset. """ print __doc__ # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # License: BSD Style. from datetime import datetime import numpy as np import py...
bsd-3-clause
tauzero7/Motion4D
python/schwarzschildLightPulse.py
1
1198
""" Light pulse in Schwarzschild spacetime """ import numpy as np import matplotlib.pyplot as plt import m4d obj = m4d.Object() obj.setMetric("SchwarzschildCart") obj.setSolver("GSL_RK4") obj.setSolverParam("eps_a", 1e-8) obj.setSolverParam("stepctrl", False) boxSize = 20.0 obj.setSolverParam("lower_bb", -1e12, -...
gpl-3.0
brianholland/tiler
tiler.py
1
7835
"""Run like python tiler.py myimage.jpg. Tiler produces myimage.txt and myimage.txt.png.""" import sys, getopt import matplotlib as mpl #http://stackoverflow.com/questions/25561009/how-do-you-i-use-mandarin-charecters-in-matplotlib #mpl.use("pgf") #I'm not there with Chinese yet. import matplotlib.pyplot as plt, cStr...
mit
ZENGXH/scikit-learn
examples/linear_model/plot_sgd_comparison.py
167
1659
""" ================================== Comparing various online solvers ================================== An example showing how different online solvers perform on the hand-written digits dataset. """ # Author: Rob Zinkov <rob at zinkov dot com> # License: BSD 3 clause import numpy as np import matplotlib.pyplot a...
bsd-3-clause
cxxgtxy/tensorflow
tensorflow/contrib/learn/python/learn/learn_io/pandas_io_test.py
111
7865
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
apache-2.0
elingg/tensorflow
tensorflow/contrib/learn/python/learn/estimators/__init__.py
6
11427
# 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