repo_name
stringlengths
7
92
path
stringlengths
5
149
copies
stringlengths
1
3
size
stringlengths
4
6
content
stringlengths
911
693k
license
stringclasses
15 values
fxia22/pointGAN
show_gan_rnn.py
1
2043
from __future__ import print_function from show3d_balls import * import argparse import os import random import numpy as np import torch import torch.nn as nn import torch.nn.parallel import torch.backends.cudnn as cudnn import torch.optim as optim import torch.utils.data import torchvision.datasets as dset import torc...
mit
shikhardb/scikit-learn
examples/linear_model/plot_iris_logistic.py
283
1678
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Logistic Regression 3-class Classifier ========================================================= Show below is a logistic-regression classifiers decision boundaries on the `iris <http://en.wikipedia.org/wiki/Iris_f...
bsd-3-clause
CartoDB/crankshaft
release/python/0.8.2/crankshaft/crankshaft/segmentation/segmentation.py
1
8893
""" Segmentation creation and prediction """ import numpy as np from sklearn.ensemble import GradientBoostingRegressor from sklearn import metrics from sklearn.cross_validation import train_test_split from crankshaft.analysis_data_provider import AnalysisDataProvider # NOTE: added optional param here class Segmenta...
bsd-3-clause
claesenm/HPOlib
HPOlib/Plotting/plotTrace_perExp.py
5
6055
#!/usr/bin/env python ## # wrapping: A program making it easy to use hyperparameter # optimization software. # Copyright (C) 2013 Katharina Eggensperger and Matthias Feurer # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # ...
gpl-3.0
GarrettSmith/Nearness
graphchi/conf/adminhtml/plots/plotter.py
3
1235
#!/usr/bin/python import sys import os import matplotlib import numpy import matplotlib matplotlib.use('AGG') import matplotlib.pyplot as plt from matplotlib.ticker import MaxNLocator from matplotlib.ticker import FormatStrFormatter def getArg(param, default=""): if (sys.argv.count(param) == 0): return default ...
gpl-3.0
sukritranjan/ranjansasselov2016b
compute_UV_doses.py
1
29816
# -*- coding: iso-8859-1 -*- """ This code is used to weigh the UV radiances we compute by biological action spectra. """ ######################## ###Import useful libraries ######################## import numpy as np import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import pdb from matplotlib.pyp...
mit
dtkav/naclports
ports/ipython-ppapi/kernel.py
7
12026
# Copyright (c) 2014 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """A simple shell that uses the IPython messaging system.""" # Override platform information. import platform platform.system = lambda: "pnacl" platform.release =...
bsd-3-clause
aquar25/losslessh264
plot_prior_misses.py
40
1124
# Run h264dec on a single file compiled with PRIOR_STATS and then run this script # Outputs timeseries plot at /tmp/misses.pdf import matplotlib.pyplot as plt from matplotlib.backends.backend_pdf import PdfPages import os def temporal_misses(key): values = data[key] numbins = 100 binsize = len(values) // n...
bsd-2-clause
omerwe/LEAP
leapUtils.py
1
10998
import numpy as np from optparse import OptionParser import scipy.linalg as la import scipy.stats as stats import scipy.linalg.blas as blas import pandas as pd import csv import time import fastlmm.util.VertexCut as vc from pysnptools.snpreader.bed import Bed import pysnptools.util as pstutil import pysnptools.util.phe...
apache-2.0
puruckertom/ubertool
ubertool/varroapop/varroapop_functions.py
1
11627
from __future__ import division #brings in Python 3.0 mixed type calculation rules import logging import json import requests import math import pandas as pd import os rest_url_varroapop = os.environ.get('OPENCPU_REST_SERVER') #rest_url_varroapop = 'http://localhost' if not os.environ.get('OPENCPU_REST_SERVER'): ...
unlicense
lobnek/pyutil
test/test_mongo/test_engine/test_strategy.py
1
3434
from pyutil.mongo.engine.strategy import Strategy, strategies, configuration from pyutil.mongo.engine.symbol import Symbol, Group from pyutil.performance.drawdown import drawdown from pyutil.performance.month import monthlytable from pyutil.performance.return_series import from_nav from pyutil.portfolio.portfolio impor...
mit
carlvlewis/bokeh
bokeh/charts/builder/tests/test_line_builder.py
33
2376
""" This is the Bokeh charts testing interface. """ #----------------------------------------------------------------------------- # Copyright (c) 2012 - 2014, Continuum Analytics, Inc. All rights reserved. # # Powered by the Bokeh Development Team. # # The full license is in the file LICENSE.txt, distributed with thi...
bsd-3-clause
lamotriz/sistemas-de-aterramento
src/agilent_u2531a.py
1
14700
# -*- coding: utf-8 -*- # Comunicacao com a placa agilent U2531A # # UFC - Universidade de Federal do Ceará # # Responsáveis: # Felipe Bandeira da Silva # Francisco Alexander # from __future__ import division import platform #if platform.system() == 'Windows': # import visa #else: # import visa_linux_emulatio...
apache-2.0
xyguo/scikit-learn
examples/model_selection/plot_underfitting_overfitting.py
53
2668
""" ============================ Underfitting vs. Overfitting ============================ This example demonstrates the problems of underfitting and overfitting and how we can use linear regression with polynomial features to approximate nonlinear functions. The plot shows the function that we want to approximate, wh...
bsd-3-clause
cgarrard/osgeopy-code
Chapter13/listing13_4.py
1
1939
# Script to draw world countries as patches. import numpy as np import matplotlib.pyplot as plt from matplotlib.path import Path import matplotlib.patches as patches from osgeo import ogr def order_coords(coords, clockwise): """Orders coordinates.""" total = 0 x1, y1 = coords[0] for x, y in coords[1:...
mit
tillahoffmann/tensorflow
tensorflow/contrib/metrics/python/kernel_tests/histogram_ops_test.py
130
9577
# 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
arthurmensch/modl
benchmarks/log.py
1
2179
import time import numpy as np from lightning.impl.primal_cd import CDClassifier from lightning.impl.sag import SAGAClassifier from sklearn.datasets import fetch_20newsgroups_vectorized from lightning.classification import SAGClassifier from sklearn.linear_model import LogisticRegression bunch = fetch_20newsgroups_v...
bsd-2-clause
phev8/ward-metrics
wardmetrics/visualisations.py
1
16641
import matplotlib.pyplot as plt def plot_events_with_segment_scores(segment_results, ground_truth_events, detected_events, use_datetime_x=False, show=True): """ Test :param segment_results: :param ground_truth_events: :param detected_events: :param use_datetime_x: :param show: :return:...
mit
cloud9ers/gurumate
environment/share/doc/ipython/examples/parallel/options/mcpricer.py
2
3552
# <nbformat>2</nbformat> # <markdowncell> # # Parallel Monto-Carlo options pricing # <markdowncell> # ## Problem setup # <codecell> from __future__ import print_function import sys import time from IPython.parallel import Client import numpy as np from mckernel import price_options from matplotlib import pyplot a...
lgpl-3.0
mattilyra/scikit-learn
examples/linear_model/plot_logistic.py
312
1426
#!/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, u...
bsd-3-clause
cactusbin/nyt
matplotlib/lib/matplotlib/tests/test_text.py
2
6893
from __future__ import print_function import numpy as np import matplotlib from matplotlib.testing.decorators import image_comparison, knownfailureif, cleanup import matplotlib.pyplot as plt import warnings from nose.tools import with_setup @image_comparison(baseline_images=['font_styles']) def test_font_styles(): ...
unlicense
spectralDNS/shenfun
docs/paper/CG/CGpaper_dirichlet.py
1
8842
""" This script has been used to compute the Dirichlet results of the paper Efficient spectral-Galerkin methods for second-order equations using different Chebyshev bases The results have been computed using Python 3.9 and Shenfun 3.1.1. The generalized Chebyshev-Tau results are computed with dedalus, and are as...
bsd-2-clause
jpautom/scikit-learn
sklearn/linear_model/tests/test_perceptron.py
378
1815
import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_raises from sklearn.utils import check_random_state from sklearn.datasets import load_iris from sklearn.linear_model import Pe...
bsd-3-clause
kashif/scikit-learn
sklearn/model_selection/tests/test_search.py
23
30837
"""Test the search module""" 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 from sklearn.utils.fixes import ...
bsd-3-clause
tracierenea/gnuradio
gr-filter/examples/channelize.py
58
7003
#!/usr/bin/env python # # Copyright 2009,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your ...
gpl-3.0
robwarm/gpaw-symm
tools/niflheim-agts.py
1
5426
import os import sys import glob import shutil import subprocess def cmd(c): x = os.system(c) assert x == 0, c def fail(subject, email=None, filename='/dev/null', mailer='mail'): assert mailer in ['mailx', 'mail', 'mutt'] import os if email is not None: if filename == '/dev/null': ...
gpl-3.0
rahul-c1/scikit-learn
examples/linear_model/lasso_dense_vs_sparse_data.py
348
1862
""" ============================== Lasso on dense and sparse data ============================== We show that linear_model.Lasso provides the same results for dense and sparse data and that in the case of sparse data the speed is improved. """ print(__doc__) from time import time from scipy import sparse from scipy ...
bsd-3-clause
micahcochran/geopandas
geopandas/tools/tests/test_sjoin.py
1
10287
from __future__ import absolute_import from distutils.version import LooseVersion import numpy as np import pandas as pd from shapely.geometry import Point, Polygon import geopandas from geopandas import GeoDataFrame, GeoSeries, read_file, base from geopandas import sjoin import pytest from pandas.util.testing impo...
bsd-3-clause
r-mart/scikit-learn
sklearn/cluster/mean_shift_.py
96
15434
"""Mean shift clustering algorithm. Mean shift clustering aims to discover *blobs* in a smooth density of samples. It is a centroid based algorithm, which works by updating candidates for centroids to be the mean of the points within a given region. These candidates are then filtered in a post-processing stage to elim...
bsd-3-clause
markelg/xray
xray/test/test_formatting.py
6
3865
import numpy as np import pandas as pd from xray.core import formatting from xray.core.pycompat import PY3 from . import TestCase class TestFormatting(TestCase): def test_get_indexer_at_least_n_items(self): cases = [ ((20,), (slice(10),)), ((3, 20,), (0, slice(10))), ...
apache-2.0
krikru/tensorflow-opencl
tensorflow/examples/learn/wide_n_deep_tutorial.py
24
8941
# 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
hmendozap/auto-sklearn
test/util/test_common.py
1
1264
# -*- encoding: utf-8 -*- from __future__ import print_function from functools import partial import os import unittest from autosklearn.util import set_auto_seed, get_auto_seed, del_auto_seed, \ check_pid class TestUtilsCommon(unittest.TestCase): _multiprocess_can_split_ = True def setUp(self): ...
bsd-3-clause
duncanmmacleod/gwpy
gwpy/plot/axes.py
1
21895
# -*- coding: utf-8 -*- # Copyright (C) Duncan Macleod (2018-2020) # # This file is part of GWpy. # # GWpy is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option)...
gpl-3.0
phronesis-mnemosyne/census-schema-alignment
wit/wit/dev/authorship-embedding.py
1
4685
import pandas as pd import urllib2 from pprint import pprint from matplotlib import pyplot as plt from bs4 import BeautifulSoup from hashlib import md5 import sys sys.path.append('/Users/BenJohnson/projects/what-is-this/wit/') from wit import * pd.set_option('display.max_rows', 50) pd.set_option('display.max_column...
apache-2.0
shikhardb/scikit-learn
sklearn/feature_selection/tests/test_chi2.py
221
2398
""" 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
xubenben/scikit-learn
sklearn/manifold/locally_linear.py
206
25061
"""Locally Linear Embedding""" # Author: Fabian Pedregosa -- <fabian.pedregosa@inria.fr> # Jake Vanderplas -- <vanderplas@astro.washington.edu> # License: BSD 3 clause (C) INRIA 2011 import numpy as np from scipy.linalg import eigh, svd, qr, solve from scipy.sparse import eye, csr_matrix from ..base import B...
bsd-3-clause
vbraga/irismatch
src/iris_detection.py
2
1707
#!/usr/bin/env python2.7 # Imported from https://gitorious.org/hough-circular-transform # License: GPLv3 # Date: Fri, Mar 7 2014 import matplotlib.pyplot as plt import matplotlib.patches as plt_patches import houghcirculartransform as hct import numpy as np def detect_iris(filename): """ Example function call...
gpl-2.0
nathanielvarona/airflow
tests/providers/apache/pinot/hooks/test_pinot.py
1
9827
# # 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...
apache-2.0
rubikloud/scikit-learn
benchmarks/bench_plot_lasso_path.py
301
4003
"""Benchmarks of Lasso regularization path computation using Lars and CD The input data is mostly low rank but is a fat infinite tail. """ from __future__ import print_function from collections import defaultdict import gc import sys from time import time import numpy as np from sklearn.linear_model import lars_pat...
bsd-3-clause
hugobowne/scikit-learn
sklearn/externals/joblib/parallel.py
31
35665
""" Helpers for embarrassingly parallel code. """ # Author: Gael Varoquaux < gael dot varoquaux at normalesup dot org > # Copyright: 2010, Gael Varoquaux # License: BSD 3 clause from __future__ import division import os import sys import gc import warnings from math import sqrt import functools import time import thr...
bsd-3-clause
nickgentoo/scikit-learn-graph
skgraph/datasets/load_graph_datasets.py
1
27349
# -*- coding: utf-8 -*- """ Created on Fri Mar 13 13:02:41 2015 Copyright 2015 Nicolo' Navarin This file is part of scikit-learn-graph. scikit-learn-graph is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either ...
gpl-3.0
SamProtas/PALiquor
geocode_fixes.py
1
2733
import os import pandas as pd import numpy as np import sqlite3 import requests import time def fix_location(lid, new_address): pd.set_option('display.mpl_style', 'default') PROJECT_ROOT = os.path.dirname(os.path.realpath(__file__)) DATABASE1 = os.path.join(PROJECT_ROOT, 'dbs', 'licensees.db') ...
gpl-2.0
liyi193328/seq2seq
seq2seq/contrib/learn/tests/dataframe/arithmetic_transform_test.py
62
2343
# 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/experiment.py
4
15233
# 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
bendalab/thunderfish
thunderfish/pulseplots.py
3
38137
""" Plot and save key steps in pulses.py for visualizing the alorithm. """ import glob import numpy as np from scipy import stats from matplotlib import rcParams, gridspec, ticker import matplotlib.pyplot as plt try: from matplotlib.colors import colorConverter as cc except ImportError: import matp...
gpl-3.0
jerjorg/BZI
BZI/convergence.py
1
6793
import numpy as np import matplotlib.pyplot as plt import time from BZI.symmetry import make_ptvecs from BZI.sampling import make_grid from BZI.pseudopots import Al_PP from BZI.integration import monte_carlo from BZI.plots import PlotMesh class Convergence(object): """ Compare integrations of pseudo-potentials by...
gpl-3.0
chrsrds/scikit-learn
examples/manifold/plot_swissroll.py
72
1295
""" =================================== Swiss Roll reduction with LLE =================================== An illustration of Swiss Roll reduction with locally linear embedding """ # Author: Fabian Pedregosa -- <fabian.pedregosa@inria.fr> # License: BSD 3 clause (C) INRIA 2011 print(__doc__) import matplotlib.pyplot...
bsd-3-clause
perrette/pyglacier
pyglacier/plotting.py
1
1106
import matplotlib.pyplot as plt # # plotting # def plot_elevation(ds, ax=None): if ax is None: ax = plt.gca() ds['hs'].plot(ax=ax,label="surface") ds['hb'].plot(ax=ax,label="bottom") # add horizontal line to indicate sea level ax.hlines(0, ds.x[0], ds.x[-1], linestyle='dashed', color='blac...
mit
samzhang111/wikipedia-jargon
all-subjects/make_tf_differences.py
1
2815
from __future__ import print_function import msgpack import sys import os from collections import defaultdict from helpers import text_dict_to_term_dict from WikiExtractor import clean, compact import pandas as pd def remove_wikipedia_markup(text): return compact(clean(text.decode('utf8'))) def print_help_and_exi...
gpl-3.0
ofgulban/scikit-image
doc/examples/filters/plot_rank_mean.py
7
1525
""" ============ Mean filters ============ This example compares the following mean filters of the rank filter package: * **local mean**: all pixels belonging to the structuring element to compute average gray level. * **percentile mean**: only use values between percentiles p0 and p1 (here 10% and 90%). * **bila...
bsd-3-clause
CrazyGuo/vincent
examples/map_examples.py
11
6721
# -*- coding: utf-8 -*- """ Vincent Map Examples """ #Build a map from scratch from vincent import * world_topo = r'world-countries.topo.json' state_topo = r'us_states.topo.json' lake_topo = r'lakes_50m.topo.json' county_geo = r'us_counties.geo.json' county_topo = r'us_counties.topo.json' or_topo = r'or_counties.t...
mit
sinhrks/scikit-learn
examples/svm/plot_custom_kernel.py
171
1546
""" ====================== SVM with custom kernel ====================== Simple usage of Support Vector Machines to classify a sample. It will plot the decision surface and the support vectors. """ print(__doc__) import numpy as np import matplotlib.pyplot as plt from sklearn import svm, datasets # import some data...
bsd-3-clause
cadrev/Titanic-Prediction
data-munging.py
1
3412
# # Title : Data munging(AKA cleaning) the Titanic Data # Author : Felan Carlo Garcia # # Notes: # -- Code is based on the Kaggle Python Tutorial # -- data cleaning prior to implementing a machine learning algorithm. import numpy as np import pandas as pd def processdata(filename, outputname): df = pd.read...
mit
IsCoolEntertainment/debpkg_python-pyzmq
examples/bench/plot_latency.py
12
2229
"""Plot latency data from messaging benchmarks. To generate the data for each library, I started the server and then did the following for each client:: from xmlrpc_client import client for i in range(9): s = '0'*10**i print s %timeit client.echo(s) """ from matplotlib.pylab import * ...
lgpl-3.0
toobaz/pandas
pandas/tests/indexes/datetimes/test_ops.py
2
18288
from datetime import datetime import warnings import numpy as np import pytest from pandas.core.dtypes.generic import ABCDateOffset import pandas as pd from pandas import ( DatetimeIndex, Index, PeriodIndex, Series, Timestamp, bdate_range, date_range, ) from pandas.tests.test_base import ...
bsd-3-clause
piyueh/PetIBM
examples/api_examples/oscillatingcylinder2dRe100_GPU/scripts/plotDragCoefficient.py
2
2057
""" Plot the drag coefficient over 4 oscillation cycles. """ import pathlib import numpy from matplotlib import pyplot from scipy import signal # Read the drag force from file. simu_dir = pathlib.Path(__file__).parents[1] data_dir = simu_dir / 'output' filepath = data_dir / 'forces-0.txt' with open(filepath, 'r') as...
bsd-3-clause
lammy/artisan
setup-mac3.py
9
8968
""" This is a setup.py script generated by py2applet Usage: python3 setup-mac3.py py2app """ # manually remove sample-data mpl subdirectory from Python installation: # sudo rm -rf /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/matplotlib/mpl-data/sample_data from distutils import s...
gpl-3.0
arjoly/scikit-learn
sklearn/ensemble/tests/test_base.py
284
1328
""" Testing for the base module (sklearn.ensemble.base). """ # Authors: Gilles Louppe # License: BSD 3 clause from numpy.testing import assert_equal from nose.tools import assert_true from sklearn.utils.testing import assert_raise_message from sklearn.datasets import load_iris from sklearn.ensemble import BaggingCla...
bsd-3-clause
matthew-tucker/mne-python
examples/time_frequency/plot_source_power_spectrum.py
19
1929
""" ========================================================= Compute power spectrum densities of the sources with dSPM ========================================================= Returns an STC file containing the PSD (in dB) of each of the sources. """ # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-pariste...
bsd-3-clause
RomainBrault/scikit-learn
sklearn/utils/deprecation.py
36
2418
import warnings __all__ = ["deprecated", ] class deprecated(object): """Decorator to mark a function or class as deprecated. Issue a warning when the function is called/the class is instantiated and adds a warning to the docstring. The optional extra argument will be appended to the deprecation mes...
bsd-3-clause
haisland0909/Denoising-Dirty-Documents
script/prediction.py
1
5057
# coding: UTF8 from sklearn.pipeline import FeatureUnion from sklearn.grid_search import GridSearchCV from sklearn import preprocessing from sklearn.ensemble import GradientBoostingRegressor, RandomForestRegressor import sklearn.linear_model import img_to_pickle as i_p import features as f import classify import prepr...
apache-2.0
skudriashev/incubator-airflow
setup.py
2
9592
# -*- 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
fbagirov/scikit-learn
benchmarks/bench_glm.py
297
1493
""" A comparison of different methods in GLM Data comes from a random square matrix. """ from datetime import datetime import numpy as np from sklearn import linear_model from sklearn.utils.bench import total_seconds if __name__ == '__main__': import pylab as pl n_iter = 40 time_ridge = np.empty(n_it...
bsd-3-clause
sjsrey/pysal
pysal/lib/common.py
4
3385
import copy import sys import time # external imports import numpy as np import numpy.linalg as la import scipy as sp import scipy.stats as stats from libpysal.cg.kdtree import KDTree from scipy.spatial.distance import pdist, cdist import pandas try: from patsy import PatsyError except ImportError: PatsyErr...
bsd-3-clause
JosmanPS/scikit-learn
sklearn/semi_supervised/label_propagation.py
128
15312
# 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...
bsd-3-clause
kedz/cuttsum
old/python/cuttsum/readers.py
1
2494
import codecs import numpy as np from sklearn.feature_extraction import DictVectorizer def gold_reader(bow_file, l_file, sim_idx, vector=u'latent'): op = codecs.open sims = [] vectors = [] labels = [] unicodes = [] last_hour = None with op(bow_file, u'r', u'utf-8') as bf, op(l_file, u'r', u...
apache-2.0
ammarkhann/FinalSeniorCode
lib/python2.7/site-packages/jupyter_core/tests/dotipython/profile_default/ipython_console_config.py
24
21691
# Configuration file for ipython-console. c = get_config() #------------------------------------------------------------------------------ # ZMQTerminalIPythonApp configuration #------------------------------------------------------------------------------ # ZMQTerminalIPythonApp will inherit config from: TerminalIP...
mit
wdurhamh/statsmodels
statsmodels/tsa/arima_model.py
9
77514
# Note: The information criteria add 1 to the number of parameters # whenever the model has an AR or MA term since, in principle, # the variance could be treated as a free parameter and restricted # This code does not allow this, but it adds consistency with other # packages such as gretl and X1...
bsd-3-clause
waynenilsen/statsmodels
statsmodels/tsa/statespace/tools.py
19
12762
""" Statespace Tools Author: Chad Fulton License: Simplified-BSD """ from __future__ import division, absolute_import, print_function import numpy as np from statsmodels.tools.data import _is_using_pandas from . import _statespace try: from scipy.linalg.blas import find_best_blas_type except ImportError: # prag...
bsd-3-clause
codingpoets/tigl
misc/math-scripts/ms_componentSegmentGeom.py
2
19336
# # Copyright (C) 2007-2013 German Aerospace Center (DLR/SC) # # Created: 2012-12-17 Martin Siggel <Martin.Siggel@dlr.de> # # 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.ap...
apache-2.0
bertdecoensel/noysim
noysim/viewer.py
1
28081
# Noysim -- Noise simulation tools for Aimsun. # Copyright (c) 2010-2011 by Bert De Coensel, Ghent University & Griffith University. # # Classes for sending and viewing noise levels in real-time import os import sys import socket import threading import time import random import msvcrt if not hasattr(sys...
mit
craigcitro/pydatalab
tests/bigquery/schema_tests.py
6
4284
# Copyright 2015 Google Inc. 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 applicable law or agreed ...
apache-2.0
claesenm/optunity-benchmark
optimizers/tpe/hyperopt_august2013_mod_src/hyperopt/mongoexp.py
2
60046
""" Mongo-based Experiment driver and worker client =============================================== Components involved: - mongo e.g. mongod ... - driver e.g. hyperopt-mongo-search mongo://address bandit_json bandit_algo_json - worker e.g. hyperopt-mongo-worker --loop mongo://address Mongo ===== Mong...
gpl-3.0
sellberg/SACLA2016B8055
scripts/03_plot_h5.py
2
1294
#!/home/doniach/dermen/epd731/bin/python import numpy as np import h5py import matplotlib import matplotlib.pyplot as plt import argparse import time import pandas as pd import sys # -- default parameters run = 448539 file_folder = '/UserData/fperakis/2016_6/01_test/' # h5 files folder src_folder = '/home/fperakis...
bsd-2-clause
pkruskal/scikit-learn
examples/cluster/plot_cluster_iris.py
350
2593
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= K-means Clustering ========================================================= The plots display firstly what a K-means algorithm would yield using three clusters. It is then shown what the effect of a bad initializa...
bsd-3-clause
berkeley-stat159/project-epsilon
code/utils/scripts/t_test_plot_script.py
1
3981
""" Purpose: ----------------------------------------------------------- This script creates graphs for t-test for 4 conditions For each subject each run each condition, plot the t statistics ----------------------------------------------------------- """ import sys, os sys.path.append(os.path.join(os.path.dirname(_...
bsd-3-clause
arvinsahni/ml4
flask/app/vizarvin.py
2
9900
from __future__ import division from flask import render_template, request, Response, jsonify,redirect,url_for,flash from werkzeug.utils import secure_filename from app import app import pandas from pandas.util import hash_pandas_object import json import psycopg2 import psycopg2.extras import os import pandas as p...
mit
MatthieuBizien/scikit-learn
examples/exercises/plot_cv_digits.py
135
1223
""" ============================================= 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
benitesf/Skin-Lesion-Analysis-Towards-Melanoma-Detection
main.py
1
9476
# Import methods of features extraction from features_extraction.feature_extraction import FeatureExtraction # Import methods of learning from learning.learning import neural_network # Import methods of classification from classification.classification import classify, confusion_matrix, total_error, local_error # fr...
mit
gprMax/gprMax
setup.py
1
7984
# Copyright (C) 2015-2020: The University of Edinburgh # Authors: Craig Warren and Antonis Giannopoulos # # This file is part of gprMax. # # gprMax 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 Foundatio...
gpl-3.0
adamrvfisher/TechnicalAnalysisLibrary
Blankrunningslate.py
1
1167
# -*- coding: utf-8 -*- """ Created on Wed Apr 5 20:13:42 2017 @author: AmatVictoriaCuramIII """ firsttime = '07/01/1983' secondtime = '01/01/1995' thirdtime = '01/01/2006' fourthtime = '01/01/2010' lasttime = '01/01/2050' ticker = '^GSPC' import pandas as pd from ChaikinAggMaker import ChaikinAggMaker ...
apache-2.0
aflaxman/scikit-learn
sklearn/__check_build/__init__.py
13
1679
""" Module to give helpful messages to the user that did not compile the scikit properly. """ import os INPLACE_MSG = """ It appears that you are importing a local scikit-learn source tree. For this, you need to have an inplace install. Maybe you are in the source directory and you need to try from another location.""...
bsd-3-clause
jstoxrocky/statsmodels
statsmodels/graphics/functional.py
31
14477
"""Module for functional boxplots.""" from statsmodels.compat.python import combinations, range import numpy as np from scipy import stats from scipy.misc import factorial from . import utils __all__ = ['fboxplot', 'rainbowplot', 'banddepth'] def fboxplot(data, xdata=None, labels=None, depth=None, method='MBD', ...
bsd-3-clause
necozay/tulip-control
tulip/transys/export/graph2dot.py
1
17106
# Copyright (c) 2013-2014 by California Institute of Technology # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of source code must retain the above copyright # notice,...
bsd-3-clause
jakobworldpeace/scikit-learn
doc/tutorial/text_analytics/solutions/exercise_02_sentiment.py
104
3139
"""Build a sentiment analysis / polarity model Sentiment analysis can be casted as a binary text classification problem, that is fitting a linear classifier on features extracted from the text of the user messages so as to guess wether the opinion of the author is positive or negative. In this examples we will use a ...
bsd-3-clause
chungjjang80/FRETBursts
fretbursts/utils/examples/matplotlib_figure_mod_toolbar.py
2
1276
""" Example on how to add widgets the toolbar of a Matplotlib figure using the QT backend. No QT application is created, only the toolbar of the native MPL figure is modified. """ from PySide import QtGui, QtCore import matplotlib def test(): plot([1,2,3], lw=2) q = qt4_interface(gcf()) return q # WA...
gpl-2.0
astroclark/bhextractor
bin/bhex_scalemassdemo.py
1
4019
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (C) 2014-2015 James Clark <james.clark@ligo.org> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or ...
gpl-2.0
justrypython/EAST
svm_model_v2.py
1
2801
#encoding:UTF-8 import os import numpy as np import sys import cv2 import matplotlib.pyplot as plt from sklearn.svm import NuSVC, SVC import datetime import pickle #calculate the area def area(p): p = p.reshape((-1, 2)) return 0.5 * abs(sum(x0*y1 - x1*y0 for ((x0, y0), (x1, y1)) in segme...
gpl-3.0
mojoboss/scikit-learn
examples/neighbors/plot_approximate_nearest_neighbors_scalability.py
225
5719
""" ============================================ Scalability of Approximate Nearest Neighbors ============================================ This example studies the scalability profile of approximate 10-neighbors queries using the LSHForest with ``n_estimators=20`` and ``n_candidates=200`` when varying the number of sa...
bsd-3-clause
michaelld/gnuradio
gnuradio-runtime/apps/evaluation_random_numbers.py
7
5284
#!/usr/bin/env python # # Copyright 2015 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # ...
gpl-3.0
jzt5132/scikit-learn
examples/ensemble/plot_adaboost_twoclass.py
347
3268
""" ================== Two-class AdaBoost ================== This example fits an AdaBoosted decision stump on a non-linearly separable classification dataset composed of two "Gaussian quantiles" clusters (see :func:`sklearn.datasets.make_gaussian_quantiles`) and plots the decision boundary and decision scores. The di...
bsd-3-clause
iamgp/pyCa
pyCa/Graph.py
1
2559
from . import * # Graphics Stuff import matplotlib.pyplot as plt class Graph(object): """docstring for Graph""" def __init__(self, Experiment): self.Experiment = Experiment self.numberOfStimulantsAdded = 0 self.nameToUse = 0 def plot(self): print '' log(self.Exp...
gpl-3.0
neuropoly/spinalcordtoolbox
spinalcordtoolbox/scripts/sct_maths.py
1
20433
#!/usr/bin/env python ######################################################################################### # # Perform mathematical operations on images # # --------------------------------------------------------------------------------------- # Copyright (c) 2015 Polytechnique Montreal <www.neuro.polymtl.ca> # A...
mit
rafaelmds/fatiando
gallery/gridder/cutting.py
6
1326
""" Cutting a section from spacial data ----------------------------------- The :func:`fatiando.gridder.cut` function extracts points from spatially distributed data that are inside a given area. It doesn't matter whether or not the points are on a regular grid. """ from fatiando import gridder import matplotlib.pypl...
bsd-3-clause
danielhkl/matplotlib2tikz
matplotlib2tikz/color.py
1
2761
# -*- coding: utf-8 -*- # import matplotlib as mpl import numpy def mpl_color2xcolor(data, matplotlib_color): '''Translates a matplotlib color specification into a proper LaTeX xcolor. ''' # Convert it to RGBA. my_col = numpy.array(mpl.colors.ColorConverter().to_rgba(matplotlib_color)) # If the a...
mit
tdhopper/scikit-learn
sklearn/decomposition/tests/test_dict_learning.py
69
8605
import numpy as np from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_less from sklearn.utils.testing import assert_raises...
bsd-3-clause
smblance/ggplot
ggplot/tests/test_chart_components.py
12
1664
from __future__ import (absolute_import, division, print_function, unicode_literals) import numpy as np import pandas as pd from nose.tools import assert_raises, assert_equal, assert_is_none from ggplot import * from ggplot.utils.exceptions import GgplotError def test_chart_components(): ...
bsd-2-clause
noahbenson/neuropythy
neuropythy/graphics/__init__.py
1
1109
#################################################################################################### # neuropythy/graphics/__init__.py # Simple tools for making matplotlib/pyplot graphics with neuropythy. # By Noah C. Benson ''' The neuropythy.graphics package contains definitions of the various tools for making plots...
agpl-3.0
google/autocjk
src/model.py
1
14838
# Copyright 2021 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 agreed to in writing, ...
apache-2.0
nikitasingh981/scikit-learn
examples/preprocessing/plot_scaling_importance.py
45
5269
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Importance of Feature Scaling ========================================================= Feature scaling though standardization (or Z-score normalization) can be an important preprocessing step for many machine learn...
bsd-3-clause