repo_name
stringlengths
7
90
path
stringlengths
5
191
copies
stringlengths
1
3
size
stringlengths
4
6
content
stringlengths
976
581k
license
stringclasses
15 values
hugobowne/scikit-learn
examples/decomposition/plot_image_denoising.py
70
6249
""" ========================================= Image denoising using dictionary learning ========================================= An example comparing the effect of reconstructing noisy fragments of a raccoon face image using firstly online :ref:`DictionaryLearning` and various transform methods. The dictionary is fi...
bsd-3-clause
ssaeger/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
rhyolight/nupic
examples/opf/clients/cpu/cpu.py
10
3122
# ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2013, 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 progra...
agpl-3.0
466152112/scikit-learn
examples/svm/plot_svm_regression.py
249
1451
""" =================================================================== Support Vector Regression (SVR) using linear and non-linear kernels =================================================================== Toy example of 1D regression using linear, polynomial and RBF kernels. """ print(__doc__) import numpy as np ...
bsd-3-clause
yushiangfu/jusa
src/fetch-test.py
1
12741
import filecmp import fetch import os from datetime import datetime, date, timedelta from urllib import request import time import pandas def need_update_stock_table_test(expect): """ test module for need_update_stock_table() """ res = fetch.need_update_stock_table() if res == expect: print('pass'...
gpl-2.0
kevinthesun/mxnet
example/autoencoder/data.py
27
1272
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
apache-2.0
JeffreyFish/DocWebTool
Rename.py
2
5793
#!/usr/bin/env python # -*- Coding: UTF-8 -*- #------------------------------------ #--Author: Jeffrey Yu #--CreationDate: 2017/10/24 14:00 #--RevisedDate: #------------------------------------ import os import pandas as pd import datetime import common def rename(x, type='umbrella'): if type == 'umbrell...
gpl-3.0
mabevillar/rmtk
tests/vulnerability/tests_TO_BE_CHANGED/NSP/fragility_process/test_spo2ida_method.py
4
2144
# -*- coding: utf-8 -*- # <nbformat>3.0</nbformat> # <codecell> """ Created on Thu May 29 11:29:32 2014 @author: chiaracasotto """ # Clear existing variables def clearall(): all = [var for var in globals() if var[0] != "_"] for var in all: del globals()[var] clearall() import pandas as pd import nump...
agpl-3.0
tobiasgehring/qudi
core/__init__.py
6
1673
# -*- coding: utf-8 -*- """ This file contains the Qudi Manager class. Qudi 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. Qudi is distrib...
gpl-3.0
anve8004/trading-with-python
nautilus/nautilus.py
77
5403
''' Created on 26 dec. 2011 Copyright: Jev Kuznetsov License: BSD ''' from PyQt4.QtCore import * from PyQt4.QtGui import * from ib.ext.Contract import Contract from ib.opt import ibConnection from ib.ext.Order import Order import tradingWithPython.lib.logger as logger from tradingWithPython.lib.eve...
bsd-3-clause
Achuth17/scikit-learn
sklearn/utils/tests/test_multiclass.py
72
15350
from __future__ import division import numpy as np import scipy.sparse as sp from itertools import product from functools import partial from sklearn.externals.six.moves import xrange from sklearn.externals.six import iteritems from scipy.sparse import issparse from scipy.sparse import csc_matrix from scipy.sparse im...
bsd-3-clause
zhenv5/scikit-learn
sklearn/metrics/tests/test_pairwise.py
71
25104
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, wminkowski from sklearn.utils.testing import assert_greater from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing impo...
bsd-3-clause
glemaitre/UnbalancedDataset
examples/under-sampling/plot_illustration_tomek_links.py
2
3511
""" ============================================== Illustration of the definition of a Tomek link ============================================== This example illustrates what is a Tomek link. """ import matplotlib.pyplot as plt import numpy as np from imblearn.under_sampling import TomekLinks print(__doc__) rng =...
mit
pnedunuri/scikit-learn
sklearn/cluster/tests/test_k_means.py
63
26190
"""Testing for K-means""" import sys import numpy as np from scipy import sparse as sp from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import SkipTest from sklearn.utils.testing i...
bsd-3-clause
edouardpoitras/NowTrade
nowtrade/figures.py
1
8093
""" This module provides an abstraction layer over matplotlib's plotting functionality. It focuses on easily plotting charts of your strategy's performance and technical indicators. """ import matplotlib.pyplot as plt from matplotlib.finance import candlestick_ochl from matplotlib.dates import date2num import pandas a...
mit
DavidTingley/ephys-processing-pipeline
installation/klustaviewa-0.3.0/klustaviewa/views/tests/test_logview.py
2
1038
"""Unit tests for log view.""" # ----------------------------------------------------------------------------- # Imports # ----------------------------------------------------------------------------- import os import sys import time import numpy as np import numpy.random as rnd import pandas as pd from...
gpl-3.0
metaml/nupic
src/nupic/research/monitor_mixin/monitor_mixin_base.py
27
5512
# ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2014, 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 progra...
agpl-3.0
AlexanderFabisch/scikit-learn
examples/svm/plot_svm_regression.py
120
1520
""" =================================================================== Support Vector Regression (SVR) using linear and non-linear kernels =================================================================== Toy example of 1D regression using linear, polynomial and RBF kernels. """ print(__doc__) import numpy as np ...
bsd-3-clause
andyraib/data-storage
python_scripts/env/lib/python3.6/site-packages/mpl_toolkits/axes_grid1/axes_divider.py
10
31231
""" The axes_divider module provides helper classes to adjust the positions of multiple axes at drawing time. Divider: this is the class that is used to calculate the axes position. It divides the given rectangular area into several sub rectangles. You initialize the divider by setting the horizontal and ...
apache-2.0
kashif/scikit-learn
sklearn/tests/test_multiclass.py
18
24010
import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_false from sklearn.utils.testing ...
bsd-3-clause
ChanderG/scipy
scipy/stats/kde.py
27
17303
#------------------------------------------------------------------------------- # # Define classes for (uni/multi)-variate kernel density estimation. # # Currently, only Gaussian kernels are implemented. # # Written by: Robert Kern # # Date: 2004-08-09 # # Modified: 2005-02-10 by Robert Kern. # Contr...
bsd-3-clause
mehdidc/scikit-learn
examples/decomposition/plot_pca_iris.py
253
1801
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= PCA example with Iris Data-set ========================================================= Principal Component Analysis applied to the Iris dataset. See `here <http://en.wikipedia.org/wiki/Iris_flower_data_set>`_ fo...
bsd-3-clause
Nathx/subs_check
code/feature_blending.py
2
5969
from main import set_spark_context from spark_model import SparkModel from datetime import datetime from pyspark.ml import Pipeline import numpy as np import pandas as pd from boto.s3.connection import S3Connection from pyspark import SparkConf, SparkContext, SQLContext from pyspark.ml.feature import StringIndexer, St...
mit
edent/Fronius-DataManager-Solar-Logger
fronius-strings.py
1
4754
## With thanks to https://github.com/grann0s/_pushPVStringData.php ## And https://forum.pvoutput.org/t/fronius-mppt-1-and-2-voltages-and-details/1259/ ## This code MIT import datetime from datetime import timedelta import pytz import os import os.path import requests import json import matplotlib as mpl mpl.use('Agg')...
mit
kezilu/pextant
pextant/explorers.py
2
11816
import logging import numpy as np from pextant.lib.geoshapely import GeoPolygon import pandas as pd logger = logging.getLogger() class TraversePath: def __init__(self, geopolygon, z, x,y,em=None, derived=None): self.geopolygon = geopolygon self.z = z self.x = x self.y = y s...
mit
YinongLong/scikit-learn
sklearn/linear_model/least_angle.py
15
57254
""" 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
rkmaddox/mne-python
tutorials/epochs/10_epochs_overview.py
7
19956
# -*- coding: utf-8 -*- """ .. _tut-epochs-class: The Epochs data structure: discontinuous data ============================================= This tutorial covers the basics of creating and working with :term:`epoched <epochs>` data. It introduces the :class:`~mne.Epochs` data structure in detail, including how to lo...
bsd-3-clause
bakfu/bakfu
bakfu/process/vectorize/tests/test_vec_sklearn.py
2
1503
# -*- coding: utf-8 -*- import pytest from bakfu.core import Chain from bakfu.process.vectorize import vec_sklearn @pytest.fixture def fixture(): ''' Creates a processor chain with test data. ''' data=((0,'data test 1'), (1,'Data test 2'), (2,'other data test 3.') ) ...
bsd-3-clause
valexandersaulys/prudential_insurance_kaggle
venv/lib/python2.7/site-packages/sklearn/feature_extraction/text.py
50
50249
# -*- coding: utf-8 -*- # Authors: Olivier Grisel <olivier.grisel@ensta.org> # Mathieu Blondel <mathieu@mblondel.org> # Lars Buitinck <L.J.Buitinck@uva.nl> # Robert Layton <robertlayton@gmail.com> # Jochen Wersdörfer <jochen@wersdoerfer.de> # Roman Sinayev <roman.sinayev@gma...
gpl-2.0
Caoimhinmg/PmagPy
programs/remanence_anisotropy_magic.py
3
27367
#!/usr/bin/env python #import matplotlib from __future__ import division from __future__ import print_function from builtins import range from past.utils import old_div import sys import pylab from pylab import * import scipy import os import pmagpy.pmag as pmag def main(): """ NAME remanence_aniso_m...
bsd-3-clause
jackbrucesimpson/DBee
src/beehaviour/csv_utils.py
1
8679
#!/usr/bin/env python import os import datetime from beehaviour import DB from .experiment import Experiment CAMERA_FRAMES_PER_SEC = 25 FRAMES_IN_AN_HOUR = CAMERA_FRAMES_PER_SEC * 60 * 60 def get_next_bee_id(): db = DB() query_statement = db.query_string(table='bees', cols=['MAX(BeeID)']) query_result =...
mit
edouardpoitras/NowTrade
nowtrade/strategy.py
1
7470
""" Strategy module iterates through all trading data, coordinates all criteria groups with actions, and feeds information to the report object for metrics. """ import pandas as pd from nowtrade import logger from nowtrade.action import LONG, SHORT, NO_ACTION, LONG_EXIT, SHORT_EXIT, ACTIONS_MAP from nowtrade import rep...
mit
mehdidc/scikit-learn
examples/svm/plot_svm_scale_c.py
223
5375
""" ============================================== Scaling the regularization parameter for SVCs ============================================== The following example illustrates the effect of scaling the regularization parameter when using :ref:`svm` for :ref:`classification <svm_classification>`. For SVC classificati...
bsd-3-clause
nelango/ViralityAnalysis
model/lib/pandas/tests/test_categorical.py
9
162878
# -*- coding: utf-8 -*- # pylint: disable=E1101,E1103,W0232 from datetime import datetime from pandas.compat import range, lrange, u, PY3 import os import pickle import re from distutils.version import LooseVersion import numpy as np import pandas as pd from pandas import Categorical, Index, Series, DataFrame, Perio...
mit
CovingtonResearchGroup/olm
olm/loggers/TruBluToolkit.py
1
1515
#Tools for reading and analysis of data from TruBlu data loggers from pandas import read_csv from pandas import concat from pandas import DataFrame import os """ Functions to read TruBlu logger files. """ #read in the CSV file from a TruBlu logger and return a pandas DataFrame def readTruBlu(csvfile): """ R...
mit
ryfeus/lambda-packs
Tensorflow_Pandas_Numpy/source3.6/keras_preprocessing/image.py
1
94844
"""Utilities for real-time data augmentation on image data. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import re from six.moves import range import os import threading import warnings import multiprocessing.pool from keras_preproc...
mit
davidam/python-examples
scikit/scikit-plot-unveil-tree-sctructure.py
47
4852
""" ========================================= Understanding the decision tree structure ========================================= The decision tree structure can be analysed to gain further insight on the relation between the features and the target to predict. In this example, we show how to retrieve: - the binary t...
gpl-3.0
ryanpepper/oommf-python
joommf/vectorfield.py
2
3858
import numpy as np import matplotlib.pyplot as plt class VectorField(object): def __init__(self, filename): f = open(filename, 'r') lines = f.readlines() for line in lines: if line.startswith('# xmin'): self.xmin = float(line[7:]) if line.startswith...
bsd-2-clause
ngoix/OCRF
sklearn/datasets/__init__.py
1
4316
""" The :mod:`sklearn.datasets` module includes utilities to load datasets, including methods to load and fetch popular reference datasets. It also features some artificial data generators. """ from .base import load_diabetes from .base import load_digits from .base import load_files from .base import load_iris from ....
bsd-3-clause
fumitoh/modelx
modelx/tests/core/space/test_new_cells_from_csv.py
1
2163
import pytest from modelx import * from modelx.tests.testdata import ( CSV_SINGLE_PARAM, CSV_MULTI_PARAMS, CSV_SINGLE_PARAM_SINGLE_COL, CSV_IRIS) @pytest.fixture(scope="session") def testmodel(): return new_model() @pytest.mark.parametrize( "param, index_col, usecols", [[None, 0, None], ...
gpl-3.0
christobal54/aei-grad-school
bin/old/plot_image_histograms.py
1
4630
##### # plots histograms of raster data ##### import os as os import aei as aei import numpy as np import gdal as gdal import matplotlib.pyplot as plt import matplotlib.mlab as mlab infiles = ['/home/cba/cba/costa_rica/Costa_Rica_Biomass_Baccini.tif', '/home/cba/cba/costa_rica/Costa_Rica_insol_total_winter....
mit
Edu-Glez/Bank_sentiment_analysis
env/lib/python3.6/site-packages/jupyter_core/tests/dotipython_empty/profile_default/ipython_notebook_config.py
13
19986
# Configuration file for ipython-notebook. c = get_config() #------------------------------------------------------------------------------ # NotebookApp configuration #------------------------------------------------------------------------------ # NotebookApp will inherit config from: BaseIPythonApplication, Appli...
apache-2.0
466152112/scikit-learn
examples/linear_model/plot_robust_fit.py
238
2414
""" Robust linear estimator fitting =============================== Here a sine function is fit with a polynomial of order 3, for values close to zero. Robust fitting is demoed in different situations: - No measurement errors, only modelling errors (fitting a sine with a polynomial) - Measurement errors in X - M...
bsd-3-clause
divyanshgaba/Summer-Training-Project
Practice/ConvolutionLayerMNISTwithPrettyTensor.py
1
4402
import matplotlib.pyplot as plt import tensorflow as tf import numpy as np import time from datetime import timedelta import math import prettytensor as pt from tensorflow.examples.tutorials.mnist import input_data data = input_data.read_data_sets('data/MNIST/',one_hot=True) data.test.cls = np.argmax(data.test.labels...
apache-2.0
dboyliao/ibis
ibis/impala/tests/test_client.py
2
7689
# Copyright 2014 Cloudera 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 writing, so...
apache-2.0
CUFCTL/face-recognition
scripts/parse_gtex.py
4
2441
#/usr/bin/python import numpy as np import cmapPy as cmap import os # dictionary for each sample type tissues = { "Adipose-Subcutaneous" : 350, "Adipose-Visceral" : 227, "Adrenal-Gland" : 145, "Artery-Aorta" : 224, "Artery-Coronary" : 133, "Artery-Tibial" : 332, "Bladder" : 11, "Brain-Amygdala" : 72, "Bra...
mit
abhishekgahlot/scikit-learn
examples/cluster/plot_dict_face_patches.py
11
2747
""" Online learning of a dictionary of parts of faces ================================================== This example uses a large dataset of faces to learn a set of 20 x 20 images patches that constitute faces. From the programming standpoint, it is interesting because it shows how to use the online API of the sciki...
bsd-3-clause
wilsonkichoi/zipline
zipline/data/treasuries.py
9
3406
# # Copyright 2013 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
sebp/scikit-survival
tests/test_datasets.py
1
18366
from io import StringIO import os import tempfile import numpy from numpy.testing import assert_array_almost_equal, assert_array_equal import pandas import pandas.util.testing as tm import pytest import sksurv.datasets as sdata from sksurv.io import writearff ARFF_CATEGORICAL_INDEX_1 = """@relation arff_categorical_...
gpl-3.0
DSLituiev/scikit-learn
examples/datasets/plot_iris_dataset.py
283
1928
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= The Iris Dataset ========================================================= This data sets consists of 3 different types of irises' (Setosa, Versicolour, and Virginica) petal and sepal length, stored in a 150x4 numpy...
bsd-3-clause
Monika319/EWEF-1
Sprawko 4/Bode/BodePlotMultifile.py
1
1525
# -*- coding: utf-8 -*- from __future__ import unicode_literals, division import numpy as np import matplotlib.pyplot as plt from matplotlib import rc import scipy.optimize import os from matplotlib.ticker import MultipleLocator, FormatStrFormatter, FixedLocator from numpy import pi rc('font', family='Consolas') from ...
gpl-2.0
kubeflow/examples
github_issue_summarization/workflow/workspace/src/recommend.py
2
1448
import argparse import keras import pandas as pd from seq2seq_utils import load_text_processor from seq2seq_utils import Seq2Seq_Inference # Parsing flags. parser = argparse.ArgumentParser() parser.add_argument("--input_csv") parser.add_argument("--input_model_h5") parser.add_argument("--input_body_preprocessor_dpkl")...
apache-2.0
wateraccounting/wa
General/data_conversions.py
1
16172
# -*- coding: utf-8 -*- """ Created on Sun Dec 18 13:07:32 2016 @author: tih """ import gzip import zipfile import gdal import osr import os import pandas as pd import numpy as np import netCDF4 import time def Convert_nc_to_tiff(input_nc, output_folder): """ This function converts the nc file into tiff files...
apache-2.0
scikit-garden/scikit-garden
skgarden/mondrian/tree/tests/test_mondrian_partial_fit.py
1
11034
""" Tests specific to incremental building of trees. """ import numpy as np from sklearn.datasets import make_classification from sklearn.datasets import make_regression from sklearn.datasets import load_digits from numpy.testing import assert_almost_equal from numpy.testing import assert_equal from numpy.testing impo...
bsd-3-clause
michaelbramwell/sms-tools
lectures/06-Harmonic-model/plots-code/spectral-peaks.py
22
1161
import numpy as np import matplotlib.pyplot as plt from scipy.signal import hamming, triang, blackmanharris import math import sys, os, functools, time sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../software/models/')) import dftModel as DFT import utilFunctions as UF (fs, x) = UF...
agpl-3.0
DemocracyClub/yournextrepresentative
ynr/apps/sopn_parsing/models.py
1
1043
import json from django.db import models from model_utils.models import TimeStampedModel class ParsedSOPN(TimeStampedModel): """ A model for storing the parsed data out of a PDF """ sopn = models.OneToOneField( "official_documents.OfficialDocument", on_delete=models.CASCADE ) raw_da...
agpl-3.0
tojojames/MVCP-Orange3
cp/tests.py
2
27714
"""Unittests for conformal prediction.""" from unittest import TestCase import os import numpy as np import sklearn.svm as skl_svm from sklearn.ensemble import RandomForestRegressor from Orange.classification import NaiveBayesLearner, LogisticRegressionLearner, SVMLearner, KNNLearner from Orange.data impor...
lgpl-3.0
LohithBlaze/scikit-learn
examples/linear_model/plot_sgd_loss_functions.py
249
1095
""" ========================== SGD: convex loss functions ========================== A plot that compares the various convex loss functions supported by :class:`sklearn.linear_model.SGDClassifier` . """ print(__doc__) import numpy as np import matplotlib.pyplot as plt def modified_huber_loss(y_true, y_pred): z ...
bsd-3-clause
soulmachine/scikit-learn
sklearn/neighbors/tests/test_neighbors.py
2
31748
from itertools import product import numpy as np from scipy.sparse import (bsr_matrix, coo_matrix, csc_matrix, csr_matrix, dok_matrix, lil_matrix) from sklearn.cross_validation import train_test_split from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing impo...
bsd-3-clause
VUIIS/dax
bin/supplemental_tools/Xnatreport_assessor.py
1
1468
#!/usr/bin/env python import json import sys import pandas import pyxnat from dax import XnatUtils from dax import utilities if len(sys.argv)!=4 : print('Usage:') print('python Xnatreport_assessor.py <project> <proctype> <output_csvfile>') sys.exit() project = sys.argv[1] proctype = sys.argv[2] outfile ...
mit
CDNoyes/EDL-Py
EntryGuidance/EntryEquations.py
1
21185
import numpy as np import sys sys.path.append("./") from EntryGuidance.EntryVehicle import EntryVehicle from EntryGuidance.Planet import Planet class Entry(object): """ Basic equations of motion for unpowered and powered flight through an atmosphere. """ def __init__(self, PlanetModel=Planet('Mars...
gpl-3.0
serl/hls-bba-testbed
pylibs/plot.py
1
41021
import log import numpy as np import cPickle as pickle from zipfile import PyZipFile from tempfile import NamedTemporaryFile from generic import is_percentage def show(plt, session, fig, export, size=None): if export: if size is None: size = (22,12) if isinstance(export, basestring): export = [export] for...
mit
KAsante95/osf.io
scripts/annotate_rsvps.py
60
2256
"""Utilities for annotating workshop RSVP data. Example :: import pandas as pd from scripts import annotate_rsvps frame = pd.read_csv('workshop.csv') annotated = annotate_rsvps.process(frame) annotated.to_csv('workshop-annotated.csv') """ import re import logging from dateutil.parser import par...
apache-2.0
aparafita/news-similarity
newsparser/scripts/retry_download.py
1
1061
# -*- coding: utf-8-*- # Author: Álvaro Parafita (parafita.alvaro@gmail.com) import pandas as pd from newsparser.updater import retry_download from newsparser.data import load_feeds folder = '/Users/alvaro_parafita/Desktop/TFG/data' feeds = load_feeds(folder) # Update local files try: for feed in feeds: ...
gpl-3.0
tbs1980/otkpp
pyotk/pyotk/plot2d.py
1
5735
"""Implements tools for drawing 2d plots. This module implements tools for drawing contour plots of objective functions and iterates on top of contour lines. """ import math import numpy from native import * from plotutils import * from testproblems import * from matplotlib.pyplot import * from numpy import arange,...
gpl-3.0
jrderuiter/im-fusion
src/imfusion/merge.py
2
3739
# -*- coding: utf-8 -*- """Implements functions for merging datasets from multiple samples.""" # pylint: disable=wildcard-import,redefined-builtin,unused-wildcard-import from __future__ import absolute_import, division, print_function from builtins import * # pylint: enable=wildcard-import,redefined-builtin,unused-wil...
mit
cainesap/mapMakeR
languagesOfTheWorld/archive/glottolog_ipython.py
1
6932
## Exploring Glottolog with Python ## from: http://nbviewer.ipython.org/gist/xflr6/9050337/glottolog.ipynb ## via: Robert Forkel <robert_forkel@eva.mpg.de> import urllib ## Download the RDF export file with Pythons built-in urllib module (docs). URL = 'http://glottolog.org/static/download/glottolog-language.n3.gz' fil...
mit
avmarchenko/exa
exa/core/numerical.py
2
15937
# -*- coding: utf-8 -*- # Copyright (c) 2015-2018, Exa Analytics Development Team # Distributed under the terms of the Apache License 2.0 """ Data Objects ################################### Data objects are used to store typed data coming from an external source (for example a file on disk). There are three primary da...
apache-2.0
liam2/liam2
liam2/charts.py
1
11591
# encoding: utf-8 from __future__ import absolute_import, division, print_function import os import math import sys import numpy as np import larray as la from liam2.compat import basestring, PY2 from liam2 import config from liam2.expr import FunctionExpr from liam2.utils import aslabeledarray, ExceptionOnGetAttr, ...
gpl-3.0
dssg/givinggraph
givinggraph/companycause/company_cause_svm.py
3
2950
#!/usr/bin/env python # # Description: This runs a support vector machine (SVM) on the # labelled dataset (company summary, donation cause). # import pickle import string import re import numpy as np from nltk.corpus import stopwords from sklearn.feature_extraction.text import TfidfVectorizer from sklearn import cros...
mit
johnboyington/homework
me777/hw5/hw5_p5.py
1
1579
import numpy as np from numpy.random import rand import matplotlib.pyplot as plt def q(x): return 3 def walk_on_lines(r, n, bounds, bound_temp, tol): s = 0 for z in range(n): x = r qs = 0 found = False while not found: L, R = abs(bounds[0] - x), abs(bounds[1] ...
gpl-3.0
prheenan/Research
Personal/EventDetection/Docs/paper/Figures/FigureRupture/main_figure_rupture.py
1
7687
# force floating point division. Can still use integer with // from __future__ import division # This file is used for importing the common utilities classes. import numpy as np import matplotlib.pyplot as plt import sys sys.path.append("../../../../../../../") from GeneralUtil.python import PlotUtilities from Researc...
gpl-3.0
bavardage/statsmodels
statsmodels/sandbox/nonparametric/dgp_examples.py
37
6008
# -*- coding: utf-8 -*- """Examples of non-linear functions for non-parametric regression Created on Sat Jan 05 20:21:22 2013 Author: Josef Perktold """ import numpy as np ## Functions def fg1(x): '''Fan and Gijbels example function 1 ''' return x + 2 * np.exp(-16 * x**2) def fg1eu(x): '''Eubank ...
bsd-3-clause
thomasgibson/tabula-rasa
HDG_CG_comp/table_cg_hdg_breakdown.py
1
5273
import os import pandas as pd hdg_params = [(64, 1), (64, 2), (64, 3)] hdg_data = ["results/HDG_data_N%d_deg%d.csv" % param for param in hdg_params] cg_params = [(64, 2), (64, 3), (64, 4)] cg_data = ["results/CG_data_N%d_deg%d.csv" % param for param in cg_params] for d in hdg_data + cg_data: ...
mit
guillochon/FriendlyFit
mosfit/plotting.py
5
4917
"""Functions for assisting with plotting, inherited from AstroCats.""" from collections import OrderedDict from random import seed, shuffle import seaborn as sns from matplotlib.colors import rgb2hex from palettable import colorbrewer, cubehelix, wesanderson __all__ = [ 'bandrepf', 'bandcolorf', 'radiocolorf', '...
mit
Adai0808/scikit-learn
sklearn/linear_model/tests/test_sgd.py
129
43401
import pickle import unittest import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_greater from sklearn.utils.testing ...
bsd-3-clause
mlperf/training_results_v0.5
v0.5.0/google/cloud_v2.512/resnet-tpuv2-512/code/resnet/model/models/official/boosted_trees/data_download.py
4
3383
# Copyright 2018 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
imaculate/scikit-learn
sklearn/linear_model/ransac.py
17
17164
# coding: utf-8 # Author: Johannes Schönberger # # License: BSD 3 clause import numpy as np import warnings from ..base import BaseEstimator, MetaEstimatorMixin, RegressorMixin, clone from ..utils import check_random_state, check_array, check_consistent_length from ..utils.random import sample_without_replacement fr...
bsd-3-clause
caseyclements/bokeh
bokeh/charts/builder/tests/test_heatmap_builder.py
33
4145
""" 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
droundy/deft
papers/polyhedra/figs/plot-pressure.py
1
1724
#!/usr/bin/python2 from __future__ import division import matplotlib, sys, os, argparse import common parser = argparse.ArgumentParser(description='Plot pressure of polyhedra.') parser.add_argument('ff', metavar='ff', type=float, help='filling fraction') parser.add_argument('-N', metavar='N', type=int, default=0, ...
gpl-2.0
dpinney/omf
omf/scratch/Neural_Net_Experimentation/deleted models/forecastStorageDeferral.py
1
8680
''' Apply PNNL VirtualBatteries (VBAT) load model to day ahead forecast.''' import pandas as pd import numpy as np from sklearn import linear_model import pulp from os.path import isdir, join as pJoin import __neoMetaModel__ from __neoMetaModel__ import * from omf import forecast as fc # Model metadata: modelName, tem...
gpl-2.0
RPGOne/Skynet
scikit-learn-c604ac39ad0e5b066d964df3e8f31ba7ebda1e0e/examples/manifold/plot_swissroll.py
330
1446
""" =================================== 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
bsipocz/scikit-image
skimage/viewer/qt.py
48
1281
_qt_version = None has_qt = True try: from matplotlib.backends.qt_compat import QtGui, QtCore, QtWidgets, QT_RC_MAJOR_VERSION as _qt_version except ImportError: try: from matplotlib.backends.qt4_compat import QtGui, QtCore QtWidgets = QtGui _qt_version = 4 except ImportError: ...
bsd-3-clause
Sentient07/scikit-learn
examples/decomposition/plot_pca_3d.py
354
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
thegooglecodearchive/mpmath
mpmath/visualization.py
6
9486
""" Plotting (requires matplotlib) """ from colorsys import hsv_to_rgb, hls_to_rgb from .libmp import NoConvergence from .libmp.backend import xrange class VisualizationMethods(object): plot_ignore = (ValueError, ArithmeticError, ZeroDivisionError, NoConvergence) def plot(ctx, f, xlim=[-5,5], ylim=Non...
bsd-3-clause
rodekruis/priorityindex
learn_v1p0.py
1
29671
# Script developed by Marco Velliscig (marco.velliscig AT gmail.com) # for the NL Red Cross # released under GNU GENERAL PUBLIC LICENSE Version 3 for the NL Red Cross # This script is for illustrative reasons only. # If you are interested in using the script please contact the 510.global team # # notes of this vers...
lgpl-3.0
Bleyddyn/malpi
exp/check_state.py
1
1373
import numpy as np import pickle import os import matplotlib.pyplot as plt import matplotlib.image as mpimg from scipy import stats with open('one_experience.pickle', 'rb') as pf: exp = pickle.load(pf) states, actions, rewards, batch_done, new_states = exp print states.shape print actions print rewards print bat...
mit
kjung/scikit-learn
sklearn/linear_model/tests/test_bayes.py
299
1770
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Fabian Pedregosa <fabian.pedregosa@inria.fr> # # License: BSD 3 clause import numpy as np from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import SkipTest from sklearn.linear_model.bayes import BayesianRidge, ARDRegres...
bsd-3-clause
drewm1980/multi_view_stereo_benchmark
benchmark.py
1
5019
#!/usr/bin/env python3 # Code for running the benchmark import pathlib from pathlib import Path import numpy import datetime import pandas from multi_view_stereo_benchmark.compare_clouds import compare_clouds from multi_view_stereo_benchmark.load_ply import load_ply def to_datetime(scanID): ''' Convert my strin...
mit
shenzebang/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
hazelnusse/robot.bicycle
plots/plot_data.py
1
7624
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """Class used for plotting data of a Message_np object. Examples ======== p = PlotData('sample_pb2', 'Sample', 'samples.dat') p.print_fields() p.plot('system_time', 'mpu6050', norm=True) p.plot('system_time', 'mpu6050.accelerometer_x') p.plot(...
bsd-2-clause
cancan101/tensorflow
tensorflow/contrib/learn/python/learn/dataframe/dataframe.py
85
4704
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
apache-2.0
blancha/abcngspipelines
utils/ensemblbedgraphtoucscbedgraph_batch_stranded.py
1
4683
#!/usr/bin/env python3 # Version 1.1 # Author Alexis Blanchet-Cohen # Date: ../2014 import argparse import glob import os import pandas import subprocess import util parser = argparse.ArgumentParser(description='Generate scripts to convert bedgraph files from Ensembl to UCSC format.') parser.add_argument("-s", "--sc...
gpl-3.0
muneebalam/scrapenhl2
scrapenhl2/scrape/parse_toi.py
1
24833
""" This module contains methods for parsing TOI. """ import os.path import re import pandas as pd import scrapenhl2.scrape.general_helpers as helpers import scrapenhl2.scrape.organization as organization import scrapenhl2.scrape.players as players import scrapenhl2.scrape.schedules as schedules import scrapenhl2.sc...
mit
tyarkoni/pliers
pliers/tests/test_stims.py
1
12234
import tempfile import os import base64 from os.path import join, exists from pathlib import Path import numpy as np import pandas as pd import pytest from .utils import get_test_data_path from pliers.stimuli import (VideoStim, VideoFrameStim, ComplexTextStim, AudioStim, ImageStim, Compoun...
bsd-3-clause
sjdv1982/seamless
tests/highlevel/highlink-cpp.py
1
1715
from seamless.highlevel import Context, Cell, Transformer ctx = Context() def calc_arr(period, npoints): import numpy as np points = np.arange(npoints) phase = points/period*np.pi*2 return np.sin(phase) ctx.period = 200 ctx.npoints = 1100 ctx.calc_arr = calc_arr ctx.calc_arr.period = ctx.period ctx.ca...
mit
sumspr/scikit-learn
sklearn/linear_model/tests/test_ransac.py
216
13290
import numpy as np from numpy.testing import assert_equal, assert_raises from numpy.testing import assert_array_almost_equal from sklearn.utils.testing import assert_raises_regexp from scipy import sparse from sklearn.utils.testing import assert_less from sklearn.linear_model import LinearRegression, RANSACRegressor f...
bsd-3-clause
voxlol/scikit-learn
sklearn/decomposition/tests/test_pca.py
199
10949
import numpy as np from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_greater from sklearn.utils.testing import assert_rai...
bsd-3-clause
macks22/scikit-learn
examples/ensemble/plot_voting_probas.py
316
2824
""" =========================================================== Plot class probabilities calculated by the VotingClassifier =========================================================== Plot the class probabilities of the first sample in a toy dataset predicted by three different classifiers and averaged by the `VotingC...
bsd-3-clause
OshynSong/scikit-learn
sklearn/neural_network/rbm.py
206
12292
"""Restricted Boltzmann Machine """ # Authors: Yann N. Dauphin <dauphiya@iro.umontreal.ca> # Vlad Niculae # Gabriel Synnaeve # Lars Buitinck # License: BSD 3 clause import time import numpy as np import scipy.sparse as sp from ..base import BaseEstimator from ..base import TransformerMixi...
bsd-3-clause