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
CalvinNeo/PyGeo
countpca_segmentation_2.py
1
7423
#coding:utf8 import numpy as np, scipy import pylab as pl import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import math from matplotlib import cm from matplotlib import mlab from matplotlib.ticker import LinearLocator, FormatStrFormatter from itertools import * import collections from multiproces...
apache-2.0
fmacias64/deap
examples/es/cma_plotting.py
12
4326
# This file is part of DEAP. # # DEAP is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation, either version 3 of # the License, or (at your option) any later version. # # DEAP is distributed ...
lgpl-3.0
asnorkin/parapapapam
ensemble/_ensemble.py
1
10880
import numpy as np from sklearn.model_selection import cross_val_predict, cross_val_score, StratifiedKFold from sklearn.base import BaseEstimator, ClassifierMixin from sklearn.svm import SVC from ..metrics import METRICS class Blender: def make_greedy_blend(self, X, y, models, scoring=None, cv=3, ...
mit
jjx02230808/project0223
examples/linear_model/plot_lasso_and_elasticnet.py
73
2074
""" ======================================== Lasso and Elastic Net for Sparse Signals ======================================== Estimates Lasso and Elastic-Net regression models on a manually generated sparse signal corrupted with an additive noise. Estimated coefficients are compared with the ground-truth. """ print(...
bsd-3-clause
skearnes/color-features
paper/code/analysis.py
1
12160
"""Analyze results. Use the saved model output to calculate AUC and other metrics. """ import collections import cPickle as pickle import gflags as flags import gzip import logging import numpy as np import os import pandas as pd from sklearn import metrics from statsmodels.stats import proportion import sys flags.D...
bsd-3-clause
manuelli/director
src/python/director/planplayback.py
1
7857
import os import vtkAll as vtk import math import time import re import numpy as np from director.timercallback import TimerCallback from director import objectmodel as om from director.simpletimer import SimpleTimer from director.utime import getUtime from director import robotstate import copy import pickle import ...
bsd-3-clause
nelango/ViralityAnalysis
model/lib/pandas/tests/test_msgpack/test_except.py
15
1043
#!/usr/bin/env python # coding: utf-8 import unittest import nose import datetime from pandas.msgpack import packb, unpackb class DummyException(Exception): pass class TestExceptions(unittest.TestCase): def test_raise_on_find_unsupported_value(self): import datetime self.assertRaises(TypeEr...
mit
druce/safewithdrawal_tensorflow
lifetable.py
1
8359
import numpy as np import pandas as pd from pandas import DataFrame ############################################################ # Life tables # https://www.ssa.gov/oact/STATS/table4c6.html ############################################################ ############################################################ # Male...
mit
ianctse/pvlib-python
pvlib/test/test_clearsky.py
1
6604
import logging pvl_logger = logging.getLogger('pvlib') import numpy as np import pandas as pd from nose.tools import raises from numpy.testing import assert_almost_equal from pandas.util.testing import assert_frame_equal, assert_series_equal from pvlib.location import Location from pvlib import clearsky from pvlib i...
bsd-3-clause
akloster/bokeh
bokeh/charts/_data_adapter.py
43
8802
"""This is the Bokeh charts interface. It gives you a high level API to build complex plot is a simple way. This is the ChartObject class, a minimal prototype class to build more chart types on top of it. It provides the mechanisms to support the shared chained methods. """ #-------------------------------------------...
bsd-3-clause
opendatadurban/scoda
scoda/public.py
1
54121
import itertools import operator from sqlalchemy_searchable import search from scoda.app import app from flask import request, url_for, redirect, flash, make_response, session, render_template, jsonify, Response, \ send_file from flask_security import current_user from itertools import zip_longest from sqlalchemy...
apache-2.0
mwindau/praktikum
v351/dreieck.py
1
1188
import numpy as np import matplotlib.pyplot as plt from scipy.stats import linregress from scipy.optimize import curve_fit oberwelle3, amplitude3 = np.genfromtxt('Rohdaten/dreieckspannung.txt',unpack=True) plt.plot(oberwelle3, amplitude3,'k.',label="Messdaten") #plt.legend(loc='best') plt.grid() #plt.xlim(0,1.5) plt.x...
mit
dhruv13J/scikit-learn
examples/svm/plot_iris.py
62
3251
""" ================================================== Plot different SVM classifiers in the iris dataset ================================================== Comparison of different linear SVM classifiers on a 2D projection of the iris dataset. We only consider the first 2 features of this dataset: - Sepal length - Se...
bsd-3-clause
ilo10/scikit-learn
examples/plot_johnson_lindenstrauss_bound.py
134
7452
""" ===================================================================== The Johnson-Lindenstrauss bound for embedding with random projections ===================================================================== The `Johnson-Lindenstrauss lemma`_ states that any high dimensional dataset can be randomly projected in...
bsd-3-clause
imatge-upc/saliency-2016-cvpr
shallow/train.py
2
3064
# add to kfkd.py from lasagne import layers from lasagne.updates import nesterov_momentum from nolearn.lasagne import NeuralNet,BatchIterator import os import numpy as np from sklearn.utils import shuffle import cPickle as pickle import matplotlib.pyplot as plt import Image import ImageOps from scipy import misc import...
mit
chankeypathak/pandas-matplotlib-examples
Lesson 9/export.py
1
1179
import pandas as pd from sqlalchemy import create_engine, MetaData, Table, select # Parameters TableName = "data" DB = { 'drivername': 'mssql+pyodbc', 'servername': 'DAVID-THINK', #'port': '5432', #'username': 'lynn', #'password': '', 'database': 'BizIntel', 'driver': 'SQL Server Native Cl...
mit
gpersistence/tstop
python/persistence/PartitionData.py
1
8153
#TSTOP # #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 3 of the License, or #(at your option) any later version. # #This program is distributed in the hope that it will be useful, ...
gpl-3.0
noelevans/sandpit
kaggle/washington_bike_share/knn_normalising.py
1
3166
import datetime import logging import math import random import pandas as pd logging.basicConfig(level=logging.INFO) INPUT_FIELDS = ('holiday', 'workingday', 'temp', 'atemp', 'humidity', 'windspeed', 'hour', 'day_of_year', 'day_of_week') PERIODICS = ('hour', 'day_of_year', 'day_of_week') RESULT_FIE...
mit
wangmiao1981/spark
python/pyspark/pandas/tests/test_stats.py
6
18881
# # 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
jtmorgan/hostbot
top_1000_report.py
1
10578
#! /usr/bin/env python from datetime import datetime, timedelta import hb_config import json import pandas as pd import requests from requests_oauthlib import OAuth1 from urllib import parse rt_header = """== Popular articles {date7} to {date1} == Last updated on ~~~~~ {{| class="wikitable sortable" !Rank !Article !...
mit
jpautom/scikit-learn
examples/text/document_clustering.py
230
8356
""" ======================================= Clustering text documents using k-means ======================================= This is an example showing how the scikit-learn can be used to cluster documents by topics using a bag-of-words approach. This example uses a scipy.sparse matrix to store the features instead of ...
bsd-3-clause
akosyakov/intellij-community
python/helpers/pydev/pydev_ipython/matplotlibtools.py
52
5401
import sys backends = {'tk': 'TkAgg', 'gtk': 'GTKAgg', 'wx': 'WXAgg', 'qt': 'Qt4Agg', # qt3 not supported 'qt4': 'Qt4Agg', 'osx': 'MacOSX'} # We also need a reverse backends2guis mapping that will properly choose which # GUI support to activate based on the...
apache-2.0
thaumos/ansible
hacking/aws_config/build_iam_policy_framework.py
25
11861
# Requires pandas, bs4, html5lib, and lxml # # Call script with the output from aws_resource_actions callback, e.g. # python build_iam_policy_framework.py ['ec2:AuthorizeSecurityGroupEgress', 'ec2:AuthorizeSecurityGroupIngress', 'sts:GetCallerIdentity'] # # The sample output: # { # "Version": "2012-10-17", # "S...
gpl-3.0
evertonaleixo/tarp
DeepLearning/deep-belief-network-example.py
1
1185
# coding=utf-8 from sklearn.datasets import load_digits from sklearn.cross_validation import train_test_split from sklearn.metrics.classification import accuracy_score import numpy as np from dbn import SupervisedDBNClassification # Loading dataset digits = load_digits() X, Y = digits.data, digits.target # Data sc...
apache-2.0
waterponey/scikit-learn
sklearn/datasets/tests/test_base.py
13
8907
import os import shutil import tempfile import warnings import numpy from pickle import loads from pickle import dumps from sklearn.datasets import get_data_home from sklearn.datasets import clear_data_home from sklearn.datasets import load_files from sklearn.datasets import load_sample_images from sklearn.datasets im...
bsd-3-clause
hansonrobotics/chatbot
src/chatbot/stats.py
1
3618
import os import logging import pandas as pd import glob import re import datetime as dt from collections import Counter logger = logging.getLogger('hr.chatbot.stats') trace_pattern = re.compile( r'../(?P<fname>.*), (?P<tloc>\(.*\)), (?P<pname>.*), (?P<ploc>\(.*\))') def collect_history_data(history_dir, days): ...
mit
uberdugo/mlia
Ch05/EXTRAS/plot2D.py
7
1276
''' Created on Oct 6, 2010 @author: Peter ''' from numpy import * import matplotlib import matplotlib.pyplot as plt from matplotlib.patches import Rectangle import logRegres dataMat,labelMat=logRegres.loadDataSet() dataArr = array(dataMat) weights = logRegres.stocGradAscent0(dataArr,labelMat) n = shap...
gpl-3.0
potash/scikit-learn
examples/ensemble/plot_adaboost_regression.py
311
1529
""" ====================================== Decision Tree Regression with AdaBoost ====================================== A decision tree is boosted using the AdaBoost.R2 [1] algorithm on a 1D sinusoidal dataset with a small amount of Gaussian noise. 299 boosts (300 decision trees) is compared with a single decision tr...
bsd-3-clause
yavalvas/yav_com
build/matplotlib/doc/mpl_examples/api/scatter_piecharts.py
6
1194
""" This example makes custom 'pie charts' as the markers for a scatter plotqu Thanks to Manuel Metz for the example """ import math import numpy as np import matplotlib.pyplot as plt # first define the ratios r1 = 0.2 # 20% r2 = r1 + 0.4 # 40% # define some sizes of the scatter marker sizes = [60,80,120] # ca...
mit
mmottahedi/neuralnilm_prototype
scripts/e249.py
2
3897
from __future__ import print_function, division import matplotlib matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab! from neuralnilm import Net, RealApplianceSource, BLSTMLayer, DimshuffleLayer from lasagne.nonlinearities import sigmoid, rectify from lasagne.objectives import crossentropy, mse...
mit
brodeau/aerobulk
python/plot_tests/plot_station_asf.py
1
9926
#!/usr/bin/env python # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- # Post-diagnostic of STATION_ASF / L. Brodeau, 2019 import sys from os import path as path #from string import replace import math import numpy as nmp from netCDF4 import Dataset,num2date import matplotlib as mpl mpl.use...
gpl-3.0
CharlesShang/TFFRCNN
lib/roi_data_layer/minibatch.py
5
8725
# -------------------------------------------------------- # Fast R-CNN # Copyright (c) 2015 Microsoft # Licensed under The MIT License [see LICENSE for details] # Written by Ross Girshick # -------------------------------------------------------- """Compute minibatch blobs for training a Fast R-CNN network.""" impor...
mit
robcarver17/pysystemtrade
sysproduction/reporting/trades_report.py
1
16443
from copy import copy from collections import namedtuple import datetime import numpy as np import pandas as pd from syscore.genutils import transfer_object_attributes from syscore.pdutils import make_df_from_list_of_named_tuple from syscore.objects import header, table, body_text, arg_not_supplied, missing_data fro...
gpl-3.0
alekz112/statsmodels
statsmodels/formula/tests/test_formula.py
29
4647
from statsmodels.compat.python import iteritems, StringIO import warnings from statsmodels.formula.api import ols from statsmodels.formula.formulatools import make_hypotheses_matrices from statsmodels.tools import add_constant from statsmodels.datasets.longley import load, load_pandas import numpy.testing as npt from...
bsd-3-clause
kubaszostak/gdal-dragndrop
osgeo/apps/Python27/Lib/site-packages/numpy/lib/twodim_base.py
2
27339
""" Basic functions for manipulating 2d arrays """ from __future__ import division, absolute_import, print_function import functools from numpy.core.numeric import ( absolute, asanyarray, arange, zeros, greater_equal, multiply, ones, asarray, where, int8, int16, int32, int64, empty, promote_types, diagonal, ...
mit
kaichogami/scikit-learn
examples/linear_model/plot_sgd_iris.py
286
2202
""" ======================================== Plot multi-class SGD on the iris dataset ======================================== Plot decision surface of multi-class SGD on iris dataset. The hyperplanes corresponding to the three one-versus-all (OVA) classifiers are represented by the dashed lines. """ print(__doc__) ...
bsd-3-clause
versae/DH2304
data/arts1.py
1
1038
import numpy as np import pandas as pd arts = pd.DataFrame() # Clean the dates so you only see numbers. def clean_years(value): result = value chars_to_replace = ["c.", "©", ", CARCC", "no date", "n.d.", " SODRAC", ", CA", " CARCC", ""] chars_to_split = ["-", "/"] if isinstance(result, str): ...
mit
john5223/airflow
airflow/hooks/hive_hooks.py
17
14064
from __future__ import print_function from builtins import zip from past.builtins import basestring import csv import logging import subprocess from tempfile import NamedTemporaryFile from thrift.transport import TSocket from thrift.transport import TTransport from thrift.protocol import TBinaryProtocol from hive_ser...
apache-2.0
ningchi/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
JamesDickenson/aima-python
submissions/aartiste/myNN.py
4
3659
from sklearn import datasets from sklearn.neural_network import MLPClassifier import traceback from submissions.aartiste import election from submissions.aartiste import county_demographics class DataFrame: data = [] feature_names = [] target = [] target_names = [] trumpECHP = DataFrame() ''' Extract...
mit
breznak/NAB
nab/labeler.py
8
16181
# ---------------------------------------------------------------------- # Copyright (C) 2014-2015, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This program is free software: you can redistribute it and/...
agpl-3.0
skoslowski/gnuradio
gr-filter/examples/fir_filter_fff.py
3
3371
#!/usr/bin/env python # # Copyright 2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # # SPDX-License-Identifier: GPL-3.0-or-later # # from __future__ import print_function from __future__ import division from __future__ import unicode_literals from gnuradio import gr, filter from gnuradio import...
gpl-3.0
kayak/fireant
fireant/queries/builder/dimension_latest_query_builder.py
1
2026
import pandas as pd from fireant.dataset.fields import Field from fireant.utils import ( alias_for_alias_selector, immutable, ) from fireant.queries.builder.query_builder import QueryBuilder, QueryException, add_hints from fireant.queries.execution import fetch_data class DimensionLatestQueryBuilder(QueryBui...
apache-2.0
anomam/pvlib-python
pvlib/tests/test_bifacial.py
2
5958
import pandas as pd import numpy as np from datetime import datetime from pvlib.bifacial import pvfactors_timeseries, PVFactorsReportBuilder from conftest import requires_pvfactors import pytest @requires_pvfactors @pytest.mark.parametrize('run_parallel_calculations', [False, True]) def test_...
bsd-3-clause
sumspr/scikit-learn
benchmarks/bench_plot_ward.py
290
1260
""" Benchmark scikit-learn's Ward implement compared to SciPy's """ import time import numpy as np from scipy.cluster import hierarchy import pylab as pl from sklearn.cluster import AgglomerativeClustering ward = AgglomerativeClustering(n_clusters=3, linkage='ward') n_samples = np.logspace(.5, 3, 9) n_features = n...
bsd-3-clause
cython-testbed/pandas
pandas/tests/groupby/test_function.py
3
38905
import pytest import numpy as np import pandas as pd from pandas import (DataFrame, Index, compat, isna, Series, MultiIndex, Timestamp, date_range) from pandas.errors import UnsupportedFunctionCall from pandas.util import testing as tm import pandas.core.nanops as nanops from string import ascii_lo...
bsd-3-clause
ChanderG/scikit-learn
sklearn/neighbors/tests/test_kde.py
208
5556
import numpy as np from sklearn.utils.testing import (assert_allclose, assert_raises, assert_equal) from sklearn.neighbors import KernelDensity, KDTree, NearestNeighbors from sklearn.neighbors.ball_tree import kernel_norm from sklearn.pipeline import make_pipeline from sklearn.dataset...
bsd-3-clause
manahl/arctic
tests/integration/tickstore/test_ts_read.py
1
30190
# -*- coding: utf-8 -*- from datetime import datetime as dt import numpy as np import pandas as pd import pytest import six from mock import patch, call, Mock from numpy.testing.utils import assert_array_equal from pandas import DatetimeIndex from pandas.util.testing import assert_frame_equal from pymongo import ReadP...
lgpl-2.1
q1ang/scikit-learn
sklearn/linear_model/bayes.py
220
15248
""" Various bayesian regression """ from __future__ import print_function # Authors: V. Michel, F. Pedregosa, A. Gramfort # License: BSD 3 clause from math import log import numpy as np from scipy import linalg from .base import LinearModel from ..base import RegressorMixin from ..utils.extmath import fast_logdet, p...
bsd-3-clause
glennlive/gnuradio-wg-grc
gr-filter/examples/fir_filter_ccc.py
47
4019
#!/usr/bin/env python # # Copyright 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 option) # ...
gpl-3.0
ml-lab/pylearn2
pylearn2/testing/skip.py
49
1363
""" Helper functions for determining which tests to skip. """ __authors__ = "Ian Goodfellow" __copyright__ = "Copyright 2010-2012, Universite de Montreal" __credits__ = ["Ian Goodfellow"] __license__ = "3-clause BSD" __maintainer__ = "LISA Lab" __email__ = "pylearn-dev@googlegroups" from nose.plugins.skip import SkipT...
bsd-3-clause
charlesll/RamPy
legacy_code/IR_dec_comb.py
1
6585
# -*- coding: utf-8 -*- """ Created on Tue Jul 22 07:54:05 2014 @author: charleslelosq Carnegie Institution for Science """ import sys sys.path.append("/Users/charleslelosq/Documents/RamPy/lib-charles/") import csv import numpy as np import scipy import matplotlib import matplotlib.gridspec as gridspec from pylab ...
gpl-2.0
vybstat/scikit-learn
examples/linear_model/plot_sgd_iris.py
286
2202
""" ======================================== Plot multi-class SGD on the iris dataset ======================================== Plot decision surface of multi-class SGD on iris dataset. The hyperplanes corresponding to the three one-versus-all (OVA) classifiers are represented by the dashed lines. """ print(__doc__) ...
bsd-3-clause
leesavide/pythonista-docs
Documentation/matplotlib/mpl_examples/pylab_examples/multi_image.py
12
2201
#!/usr/bin/env python ''' Make a set of images with a single colormap, norm, and colorbar. It also illustrates colorbar tick labelling with a multiplier. ''' from matplotlib.pyplot import figure, show, axes, sci from matplotlib import cm, colors from matplotlib.font_manager import FontProperties from numpy import ami...
apache-2.0
yask123/scikit-learn
benchmarks/bench_plot_incremental_pca.py
374
6430
""" ======================== IncrementalPCA benchmark ======================== Benchmarks for IncrementalPCA """ import numpy as np import gc from time import time from collections import defaultdict import matplotlib.pyplot as plt from sklearn.datasets import fetch_lfw_people from sklearn.decomposition import Incre...
bsd-3-clause
github4ry/pathomx
pathomx/kernel_helpers.py
2
3634
import os import sys import numpy as np import pandas as pd import re import io from matplotlib.figure import Figure, AxesStack from matplotlib.axes import Subplot from mplstyler import StylesManager import warnings from . import displayobjects from .utils import scriptdir, basedir from IPython.core import display f...
gpl-3.0
ankurankan/scikit-learn
examples/bicluster/bicluster_newsgroups.py
42
7098
""" ================================================================ Biclustering documents with the Spectral Co-clustering algorithm ================================================================ This example demonstrates the Spectral Co-clustering algorithm on the twenty newsgroups dataset. The 'comp.os.ms-windows...
bsd-3-clause
gautam1168/tardis
tardis/io/model_reader.py
5
7787
#reading different model files import numpy as np from numpy import recfromtxt, genfromtxt import pandas as pd from astropy import units as u import logging # Adding logging support logger = logging.getLogger(__name__) from tardis.util import parse_quantity class ConfigurationError(Exception): pass def read_d...
bsd-3-clause
kagayakidan/scikit-learn
sklearn/manifold/tests/test_isomap.py
226
3941
from itertools import product import numpy as np from numpy.testing import assert_almost_equal, assert_array_almost_equal from sklearn import datasets from sklearn import manifold from sklearn import neighbors from sklearn import pipeline from sklearn import preprocessing from sklearn.utils.testing import assert_less ...
bsd-3-clause
energyPATHWAYS/energyPATHWAYS
energyPATHWAYS/dispatch_maintenance.py
1
7610
from pyomo.environ import * import numpy as np import util import config as cfg import pdb import pandas as pd import copy import dispatch_budget import logging def surplus_capacity(model): return model.surplus_capacity + model.peak_penalty * model.weight_on_peak_penalty def define_penalty_to_preference_high_cos...
mit
GermanRuizMarcos/Classical-Composer-Classification
code_10_1/classification.py
1
30838
''' AUDIO CLASSICAL COMPOSER IDENTIFICATION BASED ON: A SPECTRAL BANDWISE FEATURE-BASED SYSTEM ''' import essentia from essentia.standard import * import glob import numpy as np import arff from scipy import stats import collections import cv2 import matplotlib import matplotlib.pyplot as plt #### gabor filters d...
gpl-3.0
sgenoud/scikit-learn
sklearn/mixture/tests/test_gmm.py
3
12260
import itertools import unittest import numpy as np from numpy.testing import assert_array_equal, assert_array_almost_equal, \ assert_raises from scipy import stats from sklearn import mixture from sklearn.datasets.samples_generator import make_spd_matrix rng = np.random.RandomState(0) def test_sample_gaussian...
bsd-3-clause
vickyting0910/opengeocoding
2reinter.py
1
3991
import pandas as pd import glob import time import numpy as num inter=sorted(glob.glob('*****.csv')) w='*****.xlsx' table1=pd.read_excel(w, '*****', index_col=None, na_values=['NA']).fillna(0) w='*****.csv' tab=pd.read_csv(w).fillna(0) tab.is_copy = False pd.options.mode.chained_assignment = None t1=time.time() ...
bsd-2-clause
waynenilsen/statsmodels
examples/python/robust_models_0.py
33
2992
## Robust Linear Models from __future__ import print_function import numpy as np import statsmodels.api as sm import matplotlib.pyplot as plt from statsmodels.sandbox.regression.predstd import wls_prediction_std # ## Estimation # # Load data: data = sm.datasets.stackloss.load() data.exog = sm.add_constant(data.ex...
bsd-3-clause
rvbelefonte/Rockfish2
rockfish2/extensions/cps/model.py
1
3390
""" Tools for working with Computer Programs in Seismology velocity models """ import os import numpy as np import datetime import pandas as pd from scipy.interpolate import interp1d import matplotlib.pyplot as plt from rockfish2 import logging from rockfish2.models.profile import Profile class CPSModel1d(Profile): ...
gpl-2.0
qiwsir/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
AlvinPH/StockTool
StockTool/core.py
1
7480
from . import helpers import pandas as pd import numpy as np from pandas import DataFrame, Series from pandas_datareader import data from datetime import datetime, timedelta import re import os import requests import time class StockInfo(): def __init__(self, StockNumber): if isinstance(StockNumber, str)...
bsd-2-clause
CVML/scikit-learn
examples/linear_model/plot_sparse_recovery.py
243
7461
""" ============================================================ Sparse recovery: feature selection for sparse linear models ============================================================ Given a small number of observations, we want to recover which features of X are relevant to explain y. For this :ref:`sparse linear ...
bsd-3-clause
Aasmi/scikit-learn
sklearn/cluster/tests/test_birch.py
342
5603
""" Tests for the birch clustering algorithm. """ from scipy import sparse import numpy as np from sklearn.cluster.tests.common import generate_clustered_data from sklearn.cluster.birch import Birch from sklearn.cluster.hierarchical import AgglomerativeClustering from sklearn.datasets import make_blobs from sklearn.l...
bsd-3-clause
jorik041/scikit-learn
sklearn/decomposition/pca.py
192
23117
""" Principal Component Analysis """ # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Olivier Grisel <olivier.grisel@ensta.org> # Mathieu Blondel <mathieu@mblondel.org> # Denis A. Engemann <d.engemann@fz-juelich.de> # Michael Eickenberg <michael.eickenberg@inria.fr> # # Lice...
bsd-3-clause
r-rathi/error-control-coding
perf/plot-pegd.py
1
1496
import numpy as np import matplotlib.pyplot as plt from errsim import * def label(d, pe, pb, n): if pb is None: pb = pe label = 'd={} pe={} n={} BSC'.format(d, pe, n) else: label = 'd={} pe={} n={} pb={}'.format(d, pe, n, pb) return label def plot(pe, fpath=None): fig, ax = pl...
mit
glorizen/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/dviread.py
69
29920
""" An experimental module for reading dvi files output by TeX. Several limitations make this not (currently) useful as a general-purpose dvi preprocessor. Interface:: dvi = Dvi(filename, 72) for page in dvi: # iterate over pages w, h, d = page.width, page.height, page.descent for x,y,font,gl...
agpl-3.0
theoryno3/scikit-learn
examples/linear_model/plot_bayesian_ridge.py
248
2588
""" ========================= Bayesian Ridge Regression ========================= Computes a Bayesian Ridge Regression on a synthetic dataset. See :ref:`bayesian_ridge_regression` for more information on the regressor. Compared to the OLS (ordinary least squares) estimator, the coefficient weights are slightly shift...
bsd-3-clause
timqian/sms-tools
lectures/8-Sound-transformations/plots-code/sineModelFreqScale-orchestra.py
21
2666
import numpy as np import matplotlib.pyplot as plt from scipy.signal import hamming, hanning, triang, blackmanharris, resample import math import sys, os, functools, time sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../software/models/')) sys.path.append(os.path.join(os.path.dirname...
agpl-3.0
ssh0/growing-string
triangular_lattice/diecutting/result_count_on_edge.py
1
9360
#!/usr/bin/env python # -*- coding:utf-8 -*- # # written by Shotaro Fujimoto # 2016-12-16 import matplotlib.pyplot as plt # from mpl_toolkits.mplot3d.axes3d import Axes3D import matplotlib.cm as cm import numpy as np import set_data_path class Visualizer(object): def __init__(self, subjects): self.data_...
mit
zhester/hzpy
examples/parseriff.py
1
2368
#!/usr/bin/env python """ Example RIFF (WAV contents) Data Parser Sample data is written to a CSV file for analysis. If matplotlib and numpy are available, signal plots (DFTs) are generated. """ import math import os import struct import wave try: import matplotlib.pyplot as plot import numpy import nu...
bsd-2-clause
ThomasSweijen/TPF
doc/sphinx/conf.py
1
28022
# -*- coding: utf-8 -*- # # Yade documentation build configuration file, created by # sphinx-quickstart on Mon Nov 16 21:49:34 2009. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All co...
gpl-2.0
xray/xray
xarray/core/options.py
1
5201
import warnings DISPLAY_WIDTH = "display_width" ARITHMETIC_JOIN = "arithmetic_join" ENABLE_CFTIMEINDEX = "enable_cftimeindex" FILE_CACHE_MAXSIZE = "file_cache_maxsize" WARN_FOR_UNCLOSED_FILES = "warn_for_unclosed_files" CMAP_SEQUENTIAL = "cmap_sequential" CMAP_DIVERGENT = "cmap_divergent" KEEP_ATTRS = "keep_attrs" DIS...
apache-2.0
cloud-fan/spark
python/pyspark/pandas/tests/data_type_ops/test_binary_ops.py
1
6682
# # 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
jvkersch/hsmmlearn
docs/conf.py
1
9948
# -*- coding: utf-8 -*- # # hsmmlearn documentation build configuration file, created by # sphinx-quickstart on Fri Jan 1 17:33:24 2016. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # #...
gpl-3.0
panmari/tensorflow
tensorflow/examples/skflow/boston.py
1
1485
# Copyright 2015-present Scikit Flow 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...
apache-2.0
jmrozanec/white-bkg-classification
scripts/preprocessing.py
1
1441
#https://github.com/tflearn/tflearn/issues/180 from __future__ import division, print_function, absolute_import import tflearn from tflearn.data_utils import shuffle, to_categorical from tflearn.layers.core import input_data, dropout, fully_connected from tflearn.layers.conv import conv_2d, max_pool_2d from tflearn.la...
apache-2.0
dimonaks/siman
siman/functions.py
1
29689
from __future__ import division, unicode_literals, absolute_import import os, tempfile, copy, math, itertools, sys import numpy as np from operator import itemgetter from itertools import product try: import scipy except: print('functions.py: no scipy, smoother() will not work()') from siman import header ...
gpl-2.0
yuvrajsingh86/DeepLearning_Udacity
weight-initialization/helper.py
153
3649
import numpy as np import matplotlib.pyplot as plt import tensorflow as tf def hist_dist(title, distribution_tensor, hist_range=(-4, 4)): """ Display histogram of a TF distribution """ with tf.Session() as sess: values = sess.run(distribution_tensor) plt.title(title) plt.hist(values, ...
mit
ravenshooter/BA_Analysis
Preprocess.py
1
5604
import numpy import matplotlib matplotlib.use('TkAgg') import matplotlib.pyplot as plt import scipy import mdp import csv from thread import start_new_thread import DataSet from DataAnalysis import plot from Main import getProjectPath def readFileToNumpy(fileName): reader=csv.reader(open(fileName,"rb"),delimiter=...
mit
JosmanPS/scikit-learn
sklearn/linear_model/least_angle.py
37
53448
""" Least Angle Regression algorithm. See the documentation on the Generalized Linear Model for a complete discussion. """ from __future__ import print_function # Author: Fabian Pedregosa <fabian.pedregosa@inria.fr> # Alexandre Gramfort <alexandre.gramfort@inria.fr> # Gael Varoquaux # # License: BSD 3 ...
bsd-3-clause
junwoo091400/MyCODES
Projects/FootPad_Logger/logged_data_analyzer_LSTM/RNN_LSTM.py
1
2131
from __future__ import print_function, division import numpy as np import tensorflow as tf import matplotlib.pyplot as plt import ipdb def RNN_LSTM(batch_size_in = 5, total_len_in = 30000, pad_len_in = 5, backprop_len_in = 50, state_size_in = 10, num_class_in = 32): # total_len_in = (backprop_len_in) * (num_batches...
gpl-3.0
AIML/scikit-learn
examples/decomposition/plot_pca_vs_lda.py
182
1743
""" ======================================================= Comparison of LDA and PCA 2D projection of Iris dataset ======================================================= The Iris dataset represents 3 kind of Iris flowers (Setosa, Versicolour and Virginica) with 4 attributes: sepal length, sepal width, petal length a...
bsd-3-clause
rohanp/scikit-learn
sklearn/model_selection/tests/test_validation.py
20
27961
"""Test the validation module""" from __future__ import division import sys import warnings import numpy as np from scipy.sparse import coo_matrix, csr_matrix from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_false from sklearn.utils.testing import assert_equal from sklearn.utils...
bsd-3-clause
nmartensen/pandas
pandas/io/formats/common.py
16
1094
# -*- coding: utf-8 -*- """ Common helper methods used in different submodules of pandas.io.formats """ def get_level_lengths(levels, sentinel=''): """For each index in each level the function returns lengths of indexes. Parameters ---------- levels : list of lists List of values on for level...
bsd-3-clause
phdowling/scikit-learn
sklearn/preprocessing/label.py
137
27165
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Mathieu Blondel <mathieu@mblondel.org> # Olivier Grisel <olivier.grisel@ensta.org> # Andreas Mueller <amueller@ais.uni-bonn.de> # Joel Nothman <joel.nothman@gmail.com> # Hamzeh Alsalhi <ha258@cornell.edu> # Licens...
bsd-3-clause
xwolf12/scikit-learn
sklearn/linear_model/randomized_l1.py
95
23365
""" Randomized Lasso/Logistic: feature selection based on Lasso and sparse Logistic Regression """ # Author: Gael Varoquaux, Alexandre Gramfort # # License: BSD 3 clause import itertools from abc import ABCMeta, abstractmethod import warnings import numpy as np from scipy.sparse import issparse from scipy import spar...
bsd-3-clause
joernhees/scikit-learn
sklearn/metrics/cluster/supervised.py
25
31477
"""Utilities to evaluate the clustering performance of models. Functions named as *_score return a scalar value to maximize: the higher the better. """ # Authors: Olivier Grisel <olivier.grisel@ensta.org> # Wei LI <kuantkid@gmail.com> # Diego Molla <dmolla-aliod@gmail.com> # Arnaud Fouchet ...
bsd-3-clause
MartinDelzant/scikit-learn
examples/bicluster/plot_spectral_biclustering.py
403
2011
""" ============================================= A demo of the Spectral Biclustering algorithm ============================================= This example demonstrates how to generate a checkerboard dataset and bicluster it using the Spectral Biclustering algorithm. The data is generated with the ``make_checkerboard`...
bsd-3-clause
eistre91/ThinkStats2
code/timeseries.py
66
18035
"""This file contains code for use with "Think Stats", by Allen B. Downey, available from greenteapress.com Copyright 2014 Allen B. Downey License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html """ from __future__ import print_function import pandas import numpy as np import statsmodels.formula.api as smf import st...
gpl-3.0
hrjn/scikit-learn
examples/applications/plot_model_complexity_influence.py
323
6372
""" ========================== Model Complexity Influence ========================== Demonstrate how model complexity influences both prediction accuracy and computational performance. The dataset is the Boston Housing dataset (resp. 20 Newsgroups) for regression (resp. classification). For each class of models we m...
bsd-3-clause
funbaker/astropy
astropy/table/tests/test_table.py
2
69207
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst import gc import sys import copy from io import StringIO from collections import OrderedDict import pytest import numpy as np from numpy.testing import assert_allclose from ...io import fits from ...tests.helper import (assert_fo...
bsd-3-clause
boada/planckClusters
MOSAICpipe/bpz-1.99.3/bpz.py
1
52171
""" bpz: Bayesian Photo-Z estimation Reference: Benitez 2000, ApJ, 536, p.571 Usage: python bpz.py catalog.cat Needs a catalog.columns file which describes the contents of catalog.cat """ from __future__ import print_function from __future__ import division from builtins import str from builtins import ...
mit
kylerbrown/scikit-learn
sklearn/feature_selection/tests/test_rfe.py
209
11733
""" Testing Recursive feature elimination """ import warnings import numpy as np from numpy.testing import assert_array_almost_equal, assert_array_equal from nose.tools import assert_equal, assert_true from scipy import sparse from sklearn.feature_selection.rfe import RFE, RFECV from sklearn.datasets import load_iris,...
bsd-3-clause
larsmans/scipy
scipy/stats/_discrete_distns.py
6
21338
# # Author: Travis Oliphant 2002-2011 with contributions from # SciPy Developers 2004-2011 # from __future__ import division, print_function, absolute_import from scipy import special from scipy.special import entr, gammaln as gamln from scipy.misc import logsumexp from numpy import floor, ceil, log, exp, ...
bsd-3-clause