repo_name
stringlengths
7
79
path
stringlengths
4
179
copies
stringlengths
1
3
size
stringlengths
4
6
content
stringlengths
959
798k
license
stringclasses
15 values
ricket1978/db.py
db/db.py
1
63918
import threading import glob import gzip try: from StringIO import StringIO # Python 2.7 except: from io import StringIO # Python 3.3+ import uuid import json import base64 import re import os import sys import pandas as pd from prettytable import PrettyTable import pybars from .queries import mysql as mys...
bsd-2-clause
ndevenish/simplehistogram
simplehist/hists.py
1
6669
# coding: utf-8 """ hists.py Copyright (c) 2014 Nicholas Devenish <n.e.devenish@sussex.ac.uk> An easy, quick, lightweight histogram class based on ndarray Initialise with bin indices: >>> a = Hist([0, 1, 2, 3]) >>> len(a) 3 >>> a.bins array([0, 1, 2, 3]) Optionally include data: >>> Hist([0, 1, 2, 3], ...
mit
rsteed11/GAT
gat/core/sna/pmesii.py
1
5988
# import packages import networkx as nx import numpy as np import pandas as pd # import csv or xlsx into pandas dataFrameList = (pd.read_excel("World Bank Data Iran.xlsx"), pd.read_excel("CIRI Iran.xlsx"), pd.read_excel("DPI Iran.xlsx")) df = pd.concat(dataFrameList) headerList = df.c...
mit
MohammedWasim/scikit-learn
examples/applications/plot_stock_market.py
227
8284
""" ======================================= Visualizing the stock market structure ======================================= This example employs several unsupervised learning techniques to extract the stock market structure from variations in historical quotes. The quantity that we use is the daily variation in quote ...
bsd-3-clause
wbinventor/openmc
tests/regression_tests/mgxs_library_no_nuclides/test.py
4
2092
import hashlib import openmc import openmc.mgxs from openmc.examples import pwr_pin_cell from tests.testing_harness import PyAPITestHarness class MGXSTestHarness(PyAPITestHarness): def __init__(self, *args, **kwargs): # Generate inputs using parent class routine super().__init__(*args, **kwargs)...
mit
mortada/tensorflow
tensorflow/contrib/learn/python/learn/dataframe/tensorflow_dataframe.py
75
29377
# 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
jeffzheng1/tensorflow
tensorflow/contrib/learn/python/learn/tests/dataframe/arithmetic_transform_test.py
24
2349
# 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
mxjl620/scikit-learn
sklearn/tests/test_grid_search.py
53
28730
""" Testing for grid search module (sklearn.grid_search) """ from collections import Iterable, Sized from sklearn.externals.six.moves import cStringIO as StringIO from sklearn.externals.six.moves import xrange from itertools import chain, product import pickle import sys import numpy as np import scipy.sparse as sp ...
bsd-3-clause
larsmans/scikit-learn
sklearn/metrics/tests/test_pairwise.py
20
21057
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
ch3ll0v3k/scikit-learn
sklearn/ensemble/partial_dependence.py
251
15097
"""Partial dependence plots for tree ensembles. """ # Authors: Peter Prettenhofer # License: BSD 3 clause from itertools import count import numbers import numpy as np from scipy.stats.mstats import mquantiles from ..utils.extmath import cartesian from ..externals.joblib import Parallel, delayed from ..externals im...
bsd-3-clause
nlholdem/icodoom
ICO1/deep_feedback_learning_old/vizdoom/backprop_old.py
1
8854
#!/usr/bin/env python from __future__ import print_function from vizdoom import * import sys import threading from time import sleep from matplotlib import pyplot as plt import numpy as np import cv2 sys.path.append('../../deep_feedback_learning') import deep_feedback_learning # Create DoomGame instance. It will ru...
gpl-3.0
ljwolf/pysal_core
libpysal/weights/tests/test_Distance.py
2
11190
from ...common import RTOL, ATOL, pandas from ...cg.kdtree import KDTree from ..util import get_points_array from ... import cg from ... import weights from .. import Distance as d, Contiguity as c from ...io import geotable as pdio from ...io.FileIO import FileIO as psopen import numpy as np from ... import examples ...
bsd-3-clause
dwaithe/FCS_point_correlator
focuspoint/correlation_gui.py
1
51790
import struct import numpy as np #import scipy.weave as weave import matplotlib.pyplot as plt from matplotlib.patches import Rectangle import sys, csv, os from PyQt5 import QtGui, QtCore, QtWidgets #import matplotlib #matplotlib.use('Agg') from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanva...
gpl-2.0
cdegroc/scikit-learn
examples/applications/plot_species_distribution_modeling.py
7
7349
""" ============================= Species distribution modeling ============================= Modeling species' geographic distributions is an important problem in conservation biology. In this example we model the geographic distribution of two south american mammals given past observations and 14 environmental varia...
bsd-3-clause
gbrammer/unicorn
object_examples.py
2
57686
import os import pyfits import numpy as np import glob import shutil import matplotlib.pyplot as plt USE_PLOT_GUI=False from matplotlib.figure import Figure from matplotlib.backends.backend_agg import FigureCanvasAgg import threedhst import threedhst.eazyPy as eazy import threedhst.catIO as catIO import unicorn imp...
mit
guschmue/tensorflow
tensorflow/python/estimator/canned/dnn_test.py
31
16390
# 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
supriyantomaftuh/syzygy
third_party/numpy/files/numpy/core/function_base.py
82
5474
__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...
apache-2.0
DonBeo/scikit-learn
sklearn/datasets/twenty_newsgroups.py
26
13430
"""Caching loader for the 20 newsgroups text classification dataset The description of the dataset is available on the official website at: http://people.csail.mit.edu/jrennie/20Newsgroups/ Quoting the introduction: The 20 Newsgroups data set is a collection of approximately 20,000 newsgroup documents,...
bsd-3-clause
rohanp/scikit-learn
sklearn/feature_selection/tests/test_chi2.py
56
2400
""" Tests for chi2, currently the only feature selection function designed specifically to work with sparse matrices. """ import numpy as np from scipy.sparse import coo_matrix, csr_matrix import scipy.stats from sklearn.feature_selection import SelectKBest, chi2 from sklearn.feature_selection.univariate_selection im...
bsd-3-clause
spacelis/anatool
anatool/experiment/predcate.py
1
10575
#!python # -*- coding: utf-8 -*- """File: timeweb.py Description: History: 0.1.0 The first version. """ __version__ = '0.1.0' __author__ = 'SpaceLis' from matplotlib import pyplot as plt from anatool.analysis.timemodel import TimeModel from anatool.analysis.textmodel import LanguageModel from anatool.an...
mit
dingocuster/scikit-learn
examples/model_selection/plot_roc.py
96
4487
""" ======================================= Receiver Operating Characteristic (ROC) ======================================= Example of Receiver Operating Characteristic (ROC) metric to evaluate classifier output quality. ROC curves typically feature true positive rate on the Y axis, and false positive rate on the X a...
bsd-3-clause
barentsen/dave
lpp/newlpp/lppTransform.py
1
8388
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Thu Aug 23 20:32:12 2018 Functions to correctly fold and bin a light curve. Calculate the lpp metric: transform to lower dimensions, knn Depends on class from reading in a previously created LPP metric Map Depends on reading in the light curve to data stru...
mit
idc9/law-net
vertex_metrics_experiment/code/pipeline_helper_functions.py
1
2134
import glob import pandas as pd import numpy as np from scipy.sparse import csr_matrix def load_snapshots(subnet_dir): """ Loads the snapshot data frames into a dict indexed by the file names Parameters ---------- subnet_dir: path to experiment data files Output ------ python dict ...
mit
kbrannan/PyHSPF
src/pyhspf/forecasting/extract_timeseries.py
2
7323
#!/usr/bin/env python # # extract_NRCM.py # David J. Lampert # # extracts the grid point for a watershed from the preprocessed NRCM data import os, shutil, pickle, datetime, numpy from multiprocessing import Pool, cpu_count from matplotlib import pyplot, path, patches from shapefile import Reader def ins...
bsd-3-clause
ebilionis/variational-reformulation-of-inverse-problems
unittests/test_optimize_catalysis_prop_noise_diff.py
1
6076
""" A first test for the ELBO on the catalysis problem. The target is consisted of an uninformative prior and a Gaussian likelihood. The approximating mixture has two components. Author: Panagiotis Tsilifis Date: 6/6/2014 """ import numpy as np import matplotlib.pyplot as plt import os import cPickle as p...
gpl-2.0
allenh1/rosdep
test/test_rosdep_dependency_graph.py
3
8384
# Copyright (c) 2012, Willow Garage, Inc. # 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 list of cond...
bsd-3-clause
lys-coding/4gillian
One and Only Collective/pricelist/run.py
1
1707
#!/usr/local/bin/python3 -W ignore import os import pandas as pd class PriceList: def __init__(self): self.number=[] self.name=[] self.price=[] self.map={} def from_file(self,filepath): xl=pd.ExcelFile(filepath) df=xl.parse(xl.sheet_names[0]) flag=False ...
apache-2.0
greentfrapp/adversarialautoencoder
adversarialautoencoder.py
1
22282
""" Replicates the Adversarial Autoencoder architecture (Figure 1) from Makhzani, Alireza, et al. "Adversarial autoencoders." arXiv preprint arXiv:1511.05644 (2015). https://arxiv.org/abs/1511.05644 Refer to Appendix A.1 from paper for implementation details """ try: raw_input except: raw_input = input import argpar...
mit
actuaryzhang/spark
python/pyspark/sql/utils.py
5
7527
# # 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
bikong2/scikit-learn
sklearn/utils/estimator_checks.py
21
51976
from __future__ import print_function import types import warnings import sys import traceback import inspect import pickle from copy import deepcopy import numpy as np from scipy import sparse import struct from sklearn.externals.six.moves import zip from sklearn.externals.joblib import hash, Memory from sklearn.ut...
bsd-3-clause
brunston/stellarpyl
text.py
3
12212
# -*- coding: utf-8 -*- """ stellarPYL - python stellar spectra processing software Copyright (c) 2016 Brunston Poon @file: text This program comes with absolutely no warranty. """ import time def welcome(): print(""" Welcome to stellarPYL, Copyright (C) 2015 Brunston Poon, type 'licence' for info Type 'quit' or ...
gpl-3.0
vishnumani2009/OpenSource-Open-Ended-Statistical-toolkit
FRONTEND/anovafront.py
1
9167
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'anova.ui' # # Created: Sat Apr 11 09:33:51 2015 # by: PyQt4 UI code generator 4.10.4 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 except Attribut...
gpl-3.0
jseabold/scikit-learn
sklearn/datasets/species_distributions.py
64
7917
""" ============================= Species distribution dataset ============================= This dataset represents the geographic distribution of species. The dataset is provided by Phillips et. al. (2006). The two species are: - `"Bradypus variegatus" <http://www.iucnredlist.org/apps/redlist/details/3038/0>`_...
bsd-3-clause
ssaeger/scikit-learn
doc/tutorial/text_analytics/solutions/exercise_01_language_train_model.py
25
2252
"""Build a language detector model The goal of this exercise is to train a linear classifier on text features that represent sequences of up to 3 consecutive characters so as to be recognize natural languages by using the frequencies of short character sequences as 'fingerprints'. """ # Author: Olivier Grisel <olivie...
bsd-3-clause
jbosboom/opentuner
stats_app/stats_app/views/charts.py
6
1669
import datetime import django from django.shortcuts import render from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas from matplotlib.dates import DateFormatter from matplotlib.figure import Figure import random from opentuner.utils import stats_matplotlib as stats def display_graph(request):...
mit
alfonsokim/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/mlab.py
69
104273
""" Numerical python functions written for compatability with matlab(TM) commands with the same names. Matlab(TM) compatible functions ------------------------------- :func:`cohere` Coherence (normalized cross spectral density) :func:`csd` Cross spectral density uing Welch's average periodogram :func:`detrend`...
agpl-3.0
david-ragazzi/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/pylab.py
70
10245
""" This is a procedural interface to the matplotlib object-oriented plotting library. The following plotting commands are provided; the majority have Matlab(TM) analogs and similar argument. _Plotting commands acorr - plot the autocorrelation function annotate - annotate something in the figure arrow ...
gpl-3.0
lenovor/scikit-learn
sklearn/tests/test_random_projection.py
142
14033
from __future__ import division import numpy as np import scipy.sparse as sp from sklearn.metrics import euclidean_distances from sklearn.random_projection import johnson_lindenstrauss_min_dim from sklearn.random_projection import gaussian_random_matrix from sklearn.random_projection import sparse_random_matrix from...
bsd-3-clause
wavelets/zipline
tests/risk/answer_key.py
39
11989
# # Copyright 2014 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
madcowswe/ODrive
analysis/cogging_torque/cogging_harmonics.py
2
1304
import numpy as np import matplotlib.pyplot as plt encoder_cpr = 2400 stator_slots = 12 pole_pairs = 7 N = data.size fft = np.fft.rfft(data) freq = np.fft.rfftfreq(N, d=1./encoder_cpr) harmonics = [0] harmonics += [(i+1)*stator_slots for i in range(pole_pairs)] harmonics += [pole_pairs] harmonics += [(i+1)*2*pole_p...
mit
nikitasingh981/scikit-learn
sklearn/decomposition/tests/test_kernel_pca.py
74
8472
import numpy as np import scipy.sparse as sp from sklearn.utils.testing import (assert_array_almost_equal, assert_less, assert_equal, assert_not_equal, assert_raises) from sklearn.decomposition import PCA, KernelPCA from sklearn.datasets import mak...
bsd-3-clause
schae234/gingivere
tests/motor_insert.py
2
1470
from __future__ import print_function from collections import defaultdict import copy import pandas as pd import tornado.ioloop from tornado import gen import load_raw_data import motor from tests import shelve_api def insert_patient(patient): count = 0 for data in load_raw_data.walk_training_mats(patient)...
mit
architecture-building-systems/CEAforArcGIS
cea/technologies/network_layout/steiner_spanning_tree.py
1
18985
""" This script calculates the minimum spanning tree of a shapefile network """ import math import os import networkx as nx import pandas as pd from geopandas import GeoDataFrame as gdf from networkx.algorithms.approximation.steinertree import steiner_tree from shapely.geometry import LineString from typing import...
mit
gclenaghan/scikit-learn
sklearn/ensemble/tests/test_forest.py
3
41612
""" Testing for the forest module (sklearn.ensemble.forest). """ # Authors: Gilles Louppe, # Brian Holt, # Andreas Mueller, # Arnaud Joly # License: BSD 3 clause import pickle from collections import defaultdict from itertools import combinations from itertools import product import numpy ...
bsd-3-clause
decvalts/landlab
landlab/__init__.py
1
1460
#! /usr/bin/env python """ The Landlab :Package name: TheLandlab :Version: 0.1.0 :Release date: 2013-03-24 :Authors: Greg Tucker, Nicole Gasparini, Erkan Istanbulluoglu, Daniel Hobley, Sai Nudurupati, Jordan Adams, Eric Hutton :URL: http://csdms.colorado.edu/trac/landlab :License: MIT """ from __futur...
mit
jmschrei/scikit-learn
sklearn/utils/tests/test_extmath.py
7
21916
# Authors: Olivier Grisel <olivier.grisel@ensta.org> # Mathieu Blondel <mathieu@mblondel.org> # Denis Engemann <d.engemann@fz-juelich.de> # # License: BSD 3 clause import numpy as np from scipy import sparse from scipy import linalg from scipy import stats from sklearn.utils.testing import assert_eq...
bsd-3-clause
mattdelhey/rice-scrape
scrape/scrape_eval.py
2
3448
import dryscrape import re import sys import os import numpy as np import pandas as pd sys.path.append('scrape') from helpers import login_to_evaluations UserID = '' PIN = '' project_dir = '/Users/mdelhey/rice-scrape/' YEAR_SCRAPE = '2013' TERM_SCRAPE = 'Spring' # Boilerplate os.chdir(project_dir) try: __file__...
mit
igabr/Metis_Projects_Chicago_2017
05-project-kojack/prophet_helper.py
1
1164
import pandas as pd import numpy as np from fbprophet import Prophet from datetime import date def prophet_forecast(row_of_df): holidays = [] df = pd.DataFrame(row_of_df) col_name = df.columns[0] # print("Creating time series model for {}".format(col_name)) # print("Starting_date passed to prophet is {}.".format(...
mit
eg-zhang/scikit-learn
examples/classification/plot_lda_qda.py
78
5046
""" ==================================================================== Linear and Quadratic Discriminant Analysis with confidence ellipsoid ==================================================================== Plot the confidence ellipsoids of each class and decision boundary """ print(__doc__) from scipy import lin...
bsd-3-clause
nicolas998/Op_Interpolated
06_Codigos/viejos/Figuras_Qsim.py
2
2786
#!/usr/bin/env python from wmf import wmf import numpy as np import pickle import pandas as pnd import pylab as pl import argparse import textwrap import os from multiprocessing import Pool #------------------------------------------------------------------- #FUNBCIONES LOCALES #------------------------------------...
gpl-3.0
DGrady/pandas
pandas/core/computation/ops.py
15
15900
"""Operator classes for eval. """ import operator as op from functools import partial from datetime import datetime import numpy as np from pandas.core.dtypes.common import is_list_like, is_scalar import pandas as pd from pandas.compat import PY3, string_types, text_type import pandas.core.common as com from pandas....
bsd-3-clause
cloudera/ibis
ibis/backends/pandas/execution/maps.py
1
6331
import collections import functools import pandas as pd import toolz import ibis.expr.operations as ops from ..dispatch import execute_node @execute_node.register(ops.MapLength, pd.Series) def execute_map_length_series(op, data, **kwargs): # TODO: investigate whether calling a lambda is faster return data....
apache-2.0
rflamary/POT
docs/source/auto_examples/plot_otda_d2.py
2
5388
# -*- coding: utf-8 -*- """ =================================================== OT for domain adaptation on empirical distributions =================================================== This example introduces a domain adaptation in a 2D setting. It explicits the problem of domain adaptation and introduces some optimal ...
mit
StefReck/Km3-Autoencoder
scripts/evaluation_dataset.py
1
45607
# -*- coding: utf-8 -*- """ Evaluate model performance after training. This is for comparison of supervised accuracy on different datasets. Especially for the plots for the broken data comparison. The usual setup is that simulations are broken (so that the AE has not to be trained again) so 3 tests are necessary: ...
mit
davidgbe/scikit-learn
sklearn/tests/test_metaestimators.py
226
4954
"""Common tests for metaestimators""" import functools import numpy as np from sklearn.base import BaseEstimator from sklearn.externals.six import iterkeys from sklearn.datasets import make_classification from sklearn.utils.testing import assert_true, assert_false, assert_raises from sklearn.pipeline import Pipeline...
bsd-3-clause
mbayon/TFG-MachineLearning
vbig/lib/python2.7/site-packages/pandas/tests/io/parser/test_read_fwf.py
7
15261
# -*- coding: utf-8 -*- """ Tests the 'read_fwf' function in parsers.py. This test suite is independent of the others because the engine is set to 'python-fwf' internally. """ from datetime import datetime import pytest import numpy as np import pandas as pd import pandas.util.testing as tm from pandas import DataF...
mit
joetidwell/daftHM
examples/classic.py
7
1057
""" The Quintessential PGM ====================== This is a demonstration of a very common structure found in graphical models. It has been rendered using Daft's default settings for all the parameters and it shows off how much beauty is baked in by default. """ from matplotlib import rc rc("font", family="serif", s...
mit
vortex-ape/scikit-learn
sklearn/feature_selection/rfe.py
2
20029
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Vincent Michel <vincent.michel@inria.fr> # Gilles Louppe <g.louppe@gmail.com> # # License: BSD 3 clause """Recursive feature elimination for feature ranking""" import numpy as np from ..utils import check_X_y, safe_sqr from ..utils.metaes...
bsd-3-clause
allenai/document-qa
docqa/eval/squad_full_document_eval.py
1
8928
import argparse from typing import List, Optional import numpy as np import pandas as pd from tqdm import tqdm from docqa import trainer from docqa.data_processing.qa_training_data import ContextAndQuestion, Answer, ParagraphAndQuestionDataset from docqa.data_processing.span_data import TokenSpans from docqa.data_pro...
apache-2.0
massmutual/scikit-learn
sklearn/decomposition/tests/test_truncated_svd.py
240
6055
"""Test truncated SVD transformer.""" import numpy as np import scipy.sparse as sp from sklearn.decomposition import TruncatedSVD from sklearn.utils import check_random_state from sklearn.utils.testing import (assert_array_almost_equal, assert_equal, assert_raises, assert_greater, ...
bsd-3-clause
alurban/mentoring
tidal_disruption/scripts/kepler_potentials.py
1
1465
# Imports. import numpy as np from numpy import pi import matplotlib.pyplot as plt import matplotlib.patheffects as PE from matplotlib import ticker # Physical constants. G = 6.67408e-11 # Newton's constant in m^3 / kg / s MSun = 1.989e30 # Solar mass in kg M = 1.4 * MSun # Mass of each neutron star in this exampl...
gpl-3.0
fabioticconi/scikit-learn
benchmarks/bench_plot_randomized_svd.py
38
17557
""" Benchmarks on the power iterations phase in randomized SVD. We test on various synthetic and real datasets the effect of increasing the number of power iterations in terms of quality of approximation and running time. A number greater than 0 should help with noisy matrices, which are characterized by a slow spectr...
bsd-3-clause
ashhher3/scikit-learn
examples/linear_model/plot_ransac.py
250
1673
""" =========================================== Robust linear model estimation using RANSAC =========================================== In this example we see how to robustly fit a linear model to faulty data using the RANSAC algorithm. """ import numpy as np from matplotlib import pyplot as plt from sklearn import ...
bsd-3-clause
DailyActie/Surrogate-Model
01-codes/scikit-learn-master/sklearn/manifold/tests/test_locally_linear.py
1
5242
from itertools import product import numpy as np from nose.tools import assert_true from numpy.testing import assert_almost_equal, assert_array_almost_equal from scipy import linalg from sklearn import neighbors, manifold from sklearn.manifold.locally_linear import barycenter_kneighbors_graph from sklearn.utils.testin...
mit
wazeerzulfikar/scikit-learn
examples/decomposition/plot_pca_3d.py
10
2432
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Principal components analysis (PCA) ========================================================= These figures aid in illustrating how a point cloud can be very flat in one direction--which is where PCA comes in to ch...
bsd-3-clause
aywander/pluto-outflows
Tools/pyPLUTO/examples/Sph_disk.py
3
1488
import os import sys from numpy import * from matplotlib.pyplot import * import pyPLUTO as pp plutodir = os.environ['PLUTO_DIR'] wdir = plutodir+'/Test_Problems/MHD/FARGO/Spherical_Disk/' nlinf = pp.nlast_info(w_dir=wdir,datatype='vtk') D = pp.pload(nlinf['nlast'],w_dir=wdir,datatype='vtk') # Loading the data into a ...
gpl-2.0
benneely/qdact-basic-analysis
notebooks/python_scripts/07_consultloc_tables.py
1
6839
# -*- coding: utf-8 -*- """ Created on Tue Jul 5 14:15:45 2016 @author: nn31 """ import pandas as pd import pickle import re import numpy as np from robocomp import Model from scipy import stats import scipy #read in cmmi data cmmi = pd.read_csv("/Volumes/DCCRP_projects/CMMI/data/QDACT 05-03-2016.csv", ...
gpl-3.0
antiface/mne-python
mne/decoding/tests/test_ems.py
19
1969
# Author: Denis A. Engemann <d.engemann@gmail.com> # # License: BSD (3-clause) import os.path as op from nose.tools import assert_equal, assert_raises from mne import io, Epochs, read_events, pick_types from mne.utils import requires_sklearn from mne.decoding import compute_ems data_dir = op.join(op.dirname(__file_...
bsd-3-clause
lthurlow/Network-Grapher
proj/external/matplotlib-1.2.1/lib/matplotlib/backends/backend_gtk.py
2
44416
from __future__ import division, print_function import os, sys, warnings def fn_name(): return sys._getframe(1).f_code.co_name if sys.version_info[0] >= 3: warnings.warn( "The gtk* backends have not been tested with Python 3.x", ImportWarning) try: import gobject import gtk; gdk = gtk.gdk...
mit
CforED/Machine-Learning
examples/feature_selection/plot_rfe_with_cross_validation.py
161
1380
""" =================================================== Recursive feature elimination with cross-validation =================================================== A recursive feature elimination example with automatic tuning of the number of features selected with cross-validation. """ print(__doc__) import matplotlib.p...
bsd-3-clause
jusjusjus/Motiftoolbox
Fitzhugh_3-cell/webrun.py
1
5211
#!/usr/bin/env python import matplotlib # matplotlib.use('Agg') # This prevents the x server to start. import mpld3 as m from mpld3 import plugins from flask import Flask,request import pylab as pl import numpy as np import system as sys import info as nf import network3N as netw import torus as tor import traces as...
gpl-2.0
louispotok/pandas
pandas/tests/frame/test_replace.py
3
44681
# -*- coding: utf-8 -*- from __future__ import print_function import pytest from datetime import datetime import re from pandas.compat import (zip, range, lrange, StringIO) from pandas import (DataFrame, Series, Index, date_range, compat, Timestamp) import pandas as pd from numpy import nan imp...
bsd-3-clause
katyhuff/cyder
output/contour_plot.py
1
10705
""" Comparison of griddata and tricontour for an unstructured triangular grid. """ from __future__ import print_function import matplotlib.pyplot as plt from pylab import * import matplotlib.tri as tri import numpy as np from numpy.random import uniform, seed from matplotlib.mlab import griddata import pdb class Co...
bsd-3-clause
brianlorenz/COSMOS_IMACS_Redshifts
Emission_Fitting/FitEmissionOneSig.py
1
38467
#Fits an emission ine with a Gaussian and returns the amplitude, standard deviation, and continuum line #Usage: run FitEmission.py 'a6' 4861 to fit the lines at rest wavelengths 6563 (Ha) for the a6 mask. #Typing run FitEmission.py 'a6' 'HaNII' will fit all three lines around Ha simulaaneously import numpy ...
mit
daodaoliang/bokeh
examples/plotting/server/boxplot.py
42
2372
# The plot server must be running # Go to http://localhost:5006/bokeh to view this plot import numpy as np import pandas as pd from bokeh.plotting import figure, show, output_server # Generate some synthetic time series for six different categories cats = list("abcdef") data = np.random.randn(2000) g = np.random.cho...
bsd-3-clause
winklerand/pandas
pandas/tests/tseries/offsets/test_offsets.py
1
131710
import os from distutils.version import LooseVersion from datetime import date, datetime, timedelta import pytest from pandas.compat import range from pandas import compat import numpy as np from pandas.compat.numpy import np_datetime64_compat from pandas.core.series import Series from pandas.tseries.frequencies im...
bsd-3-clause
kedz/cuttsum
trec2015/cuttsum/summarizers/_oracle.py
1
12599
import os from cuttsum.resources import MultiProcessWorker from cuttsum.pipeline import ArticlesResource from cuttsum.misc import si2df import cuttsum.judgements import numpy as np import pandas as pd import sumpy class RetrospectiveMonotoneSubmodularOracle(MultiProcessWorker): def __init__(self): self.d...
apache-2.0
mixturemodel-flow/tensorflow
tensorflow/contrib/learn/python/learn/tests/dataframe/dataframe_test.py
62
3753
# 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
hrjn/scikit-learn
examples/model_selection/plot_validation_curve.py
141
1931
""" ========================== Plotting Validation Curves ========================== In this plot you can see the training scores and validation scores of an SVM for different values of the kernel parameter gamma. For very low values of gamma, you can see that both the training score and the validation score are low. ...
bsd-3-clause
xapharius/HadoopML
Engine/src/examples/ensemble_simulation.py
2
2325
''' Created on Mar 23, 2015 @author: xapharius ''' import numpy as np from simulation.mr_simulator.ensemble_simulator import EnsembleSimulator from simulation.sampler.bootstrap_sampler import BootstrapSampler from sklearn.linear_model import LinearRegression from datahandler.numerical2.numerical_data_handler import...
mit
surhudm/scipy
scipy/integrate/_bvp.py
61
39966
"""Boundary value problem solver.""" from __future__ import division, print_function, absolute_import from warnings import warn import numpy as np from numpy.linalg import norm, pinv from scipy.sparse import coo_matrix, csc_matrix from scipy.sparse.linalg import splu from scipy.optimize import OptimizeResult EPS =...
bsd-3-clause
joshloyal/pydata-amazon-products
amazon_products/text_plots.py
1
5332
import numpy as np import pandas as pd import seaborn as sns import wordcloud from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.decomposition import TruncatedSVD from sklearn.manifold import TSNE from sklearn.preprocessing import Normalizer from sklearn.pipeline import make_pipeline def sample...
mit
HopeFOAM/HopeFOAM
ThirdParty-0.1/ParaView-5.0.1/Applications/ParaView/Testing/Python/TestPythonViewMatplotlibScript.py
1
1798
# Set up a basic scene for rendering. from paraview.simple import * import os import sys script = """ import paraview.numpy_support # Utility to get next color def getNextColor(): colors = 'bgrcmykw' for c in colors: yield c # This function must be defined. It is where specific data arrays are requested. def...
gpl-3.0
phoebe-project/phoebe2-docs
2.1/examples/legacy.py
1
5270
#!/usr/bin/env python # coding: utf-8 # Comparing PHOEBE 2 vs PHOEBE Legacy # ============================ # # **NOTE**: PHOEBE 1.0 legacy is an alternate backend and is not installed with PHOEBE 2.0. In order to run this backend, you'll need to have [PHOEBE 1.0](https://phoebe-project.org/1.0) installed and manuall...
gpl-3.0
andyraib/data-storage
python_scripts/env/lib/python3.6/site-packages/mpl_toolkits/axes_grid1/axes_rgb.py
6
7005
from __future__ import (absolute_import, division, print_function, unicode_literals) import six import numpy as np from .axes_divider import make_axes_locatable, Size, locatable_axes_factory import sys from .mpl_axes import Axes def make_rgb_axes(ax, pad=0.01, axes_class=None, add_all=True):...
apache-2.0
DonBeo/statsmodels
statsmodels/duration/tests/test_phreg.py
6
11981
import os import numpy as np from statsmodels.duration.hazard_regression import PHReg from numpy.testing import (assert_allclose, assert_equal) import pandas as pd # TODO: Include some corner cases: data sets with empty strata, strata # with no events, entry times after censoring times,...
bsd-3-clause
animesh-garg/cgt
examples/broken/mnist_torchstyle.py
22
3157
import numpy as np import matplotlib.pyplot as plt from sklearn.datasets import fetch_mldata mnist = fetch_mldata('MNIST original', data_home='~/cgt/data') # XXX print(mnist.data.shape) print(mnist.target.shape) np.unique(mnist.target) #plt.imshow(mnist.data[1, :].reshape(28, 28)) #plt.show() # do some preprocess...
mit
mbayon/TFG-MachineLearning
venv/lib/python3.6/site-packages/sklearn/feature_selection/tests/test_feature_select.py
43
26651
""" Todo: cross-check the F-value with stats model """ from __future__ import division import itertools import warnings import numpy as np from scipy import stats, sparse from numpy.testing import run_module_suite from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from...
mit
skosukhin/spack
lib/spack/docs/tutorial/examples/PyPackage/0.package.py
1
2422
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
lgpl-2.1
dieterich-lab/dorina
app/main.py
1
2510
#!/usr/bin/env python # -*- coding: utf-8 """ Created on 16:54 19/03/2018 2018 """ import pandas as pd from bokeh.io import curdoc from bokeh.layouts import layout, widgetbox from bokeh.models import ColumnDataSource, HoverTool, Div from bokeh.models.widgets import Slider, Select, TextInput from bokeh.plotting import...
gpl-3.0
marcocaccin/scikit-learn
examples/neighbors/plot_digits_kde_sampling.py
251
2022
""" ========================= Kernel Density Estimation ========================= This example shows how kernel density estimation (KDE), a powerful non-parametric density estimation technique, can be used to learn a generative model for a dataset. With this generative model in place, new samples can be drawn. These...
bsd-3-clause
dabura667/electrum
lib/plot.py
1
1704
from PyQt5.QtGui import * from electrum.i18n import _ import datetime from collections import defaultdict from electrum.util import format_satoshis from electrum.bitcoin import COIN import matplotlib matplotlib.use('Qt5Agg') import matplotlib.pyplot as plt import matplotlib.dates as md from matplotlib.patches impor...
mit
kgullikson88/HET-Scripts
MakeMassRatioDistribution.py
1
9579
""" This script goes through the stars observed, and searches for both known and new companions to each target. Right now, it only does known companions automatically """ import sys import os from matplotlib import rc import pySIMBAD as sim # rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']}) ## fo...
gpl-3.0
HopkinsIDD/EpiForecastStatMech
epi_forecast_stat_mech/datasets/nanhandling.py
1
3953
# Lint as: python3 """A few methods to handle NaNs. Library functions that take a numpy array. Assumes dimensions are (location, time). """ import itertools import matplotlib.pyplot as plt import numpy as np import scipy import scipy.ndimage def _assume_2d(array): if len(array.shape) != 2: raise ValueError( ...
gpl-3.0
saguziel/incubator-airflow
scripts/perf/scheduler_ops_metrics.py
30
6536
# -*- 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, softw...
apache-2.0
f3r/scikit-learn
sklearn/metrics/tests/test_regression.py
272
6066
from __future__ import division, print_function import numpy as np from itertools import product from sklearn.utils.testing import assert_raises from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils....
bsd-3-clause
davidgbe/scikit-learn
examples/applications/face_recognition.py
191
5513
""" =================================================== Faces recognition example using eigenfaces and SVMs =================================================== The dataset used in this example is a preprocessed excerpt of the "Labeled Faces in the Wild", aka LFW_: http://vis-www.cs.umass.edu/lfw/lfw-funneled.tgz (2...
bsd-3-clause
ishanic/scikit-learn
examples/svm/plot_separating_hyperplane_unbalanced.py
329
1850
""" ================================================= SVM: Separating hyperplane for unbalanced classes ================================================= Find the optimal separating hyperplane using an SVC for classes that are unbalanced. We first find the separating plane with a plain SVC and then plot (dashed) the ...
bsd-3-clause
stevenzhang18/Indeed-Flask
lib/pandas/stats/tests/test_moments.py
9
86813
import nose import sys import functools import warnings from datetime import datetime from numpy.random import randn from numpy.testing.decorators import slow import numpy as np from distutils.version import LooseVersion from pandas import Series, DataFrame, Panel, bdate_range, isnull, notnull, concat from pandas.uti...
apache-2.0
johndpope/tensorflow
tensorflow/contrib/learn/python/learn/estimators/estimator.py
5
55283
# 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