repo_name stringlengths 6 67 | path stringlengths 5 185 | copies stringlengths 1 3 | size stringlengths 4 6 | content stringlengths 1.02k 962k | license stringclasses 15
values |
|---|---|---|---|---|---|
ericnam808/sjsu-cs185c-yearofmusic-ml | demo_classifier.py | 1 | 3125 | """
Script for demonstrating classifiers.
:author: M. Layman
"""
from sklearn.externals import joblib
from sklearn.preprocessing import LabelEncoder
from sklearn.feature_extraction.text import CountVectorizer
import heapq, itertools, threading
def _sift_results_(i, j, n=10, threshold=0.00001):
"""
Filters o... | mit |
Jimmy-Morzaria/scikit-learn | sklearn/linear_model/tests/test_theil_sen.py | 234 | 9928 | """
Testing for Theil-Sen module (sklearn.linear_model.theil_sen)
"""
# Author: Florian Wilhelm <florian.wilhelm@gmail.com>
# License: BSD 3 clause
from __future__ import division, print_function, absolute_import
import os
import sys
from contextlib import contextmanager
import numpy as np
from numpy.testing import ... | bsd-3-clause |
alexandrebarachant/mne-python | mne/viz/tests/test_utils.py | 1 | 4889 | # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
#
# License: Simplified BSD
import os.path as op
import warnings
import numpy as np
from nose.tools import assert_true, assert_raises
from numpy.testing import assert_allclose
from mne.viz.utils import (compare_fiff, _fake_click, _compute_scaling... | bsd-3-clause |
mjgrav2001/scikit-learn | examples/cluster/plot_dbscan.py | 346 | 2479 | # -*- coding: utf-8 -*-
"""
===================================
Demo of DBSCAN clustering algorithm
===================================
Finds core samples of high density and expands clusters from them.
"""
print(__doc__)
import numpy as np
from sklearn.cluster import DBSCAN
from sklearn import metrics
from sklearn... | bsd-3-clause |
AlexRobson/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 |
allevato/swift | utils/dev-scripts/scurve_printer.py | 37 | 2875 | #!/usr/bin/env python
# This is a simple script that takes in an scurve file produced by
# csvcolumn_to_scurve and produces a png graph of the scurve.
import argparse
import csv
import matplotlib.pyplot as plt
import numpy as np
FIELDS = ['N/total', 'New/Old']
def get_data(input_file):
global FIELDS
for ... | apache-2.0 |
Morisset/PyNeb_devel | pyneb/sample_scripts/plot_Fe3.py | 1 | 4901 | # plot_Fe3 example script
# Plots diagnostic diagrams from several Fe III lines, using two different sets of atomic data
import numpy as np
import pyneb as pn
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
pn.config.set_noExtrapol(True)
pn.log_.level = 3
# Read the observed in... | gpl-3.0 |
rvraghav93/scikit-learn | sklearn/ensemble/tests/test_voting_classifier.py | 15 | 14956 | """Testing for the VotingClassifier"""
import numpy as np
from sklearn.utils.testing import assert_almost_equal, assert_array_equal
from sklearn.utils.testing import assert_equal, assert_true, assert_false
from sklearn.utils.testing import assert_raise_message
from sklearn.exceptions import NotFittedError
from sklearn... | bsd-3-clause |
jblackburne/scikit-learn | sklearn/metrics/classification.py | 3 | 71852 | """Metrics to assess performance on classification task given class prediction
Functions named as ``*_score`` return a scalar value to maximize: the higher
the better
Function named as ``*_error`` or ``*_loss`` return a scalar value to minimize:
the lower the better
"""
# Authors: Alexandre Gramfort <alexandre.gramf... | bsd-3-clause |
grlee77/scipy | scipy/optimize/_lsq/least_squares.py | 12 | 39190 | """Generic interface for least-squares minimization."""
from warnings import warn
import numpy as np
from numpy.linalg import norm
from scipy.sparse import issparse, csr_matrix
from scipy.sparse.linalg import LinearOperator
from scipy.optimize import _minpack, OptimizeResult
from scipy.optimize._numdiff import approx... | bsd-3-clause |
rajegannathan/grasp-lift-eeg-cat-dog-solution-updated | python-packages/mne-python-0.10/examples/preprocessing/plot_define_target_events.py | 19 | 3350 | """
============================================================
Define target events based on time lag, plot evoked response
============================================================
This script shows how to define higher order events based on
time lag between reference and target events. For
illustration, we will... | bsd-3-clause |
shakamunyi/tensorflow | tensorflow/contrib/timeseries/examples/multivariate.py | 67 | 5155 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
luzhijun/Optimization | CMA-ES/分段数对效果的影响/fig.py | 1 | 1626 | #!usr/bin/env python
#encoding: utf-8
__author__="luzhijun"
'''
cma restart test
'''
import numpy as np
import matplotlib.pyplot as plt
import os
plt.rc('figure', figsize=(16, 9))
import makeData as md
div=[1,4,13,14,22,49]
def drawHeatMap(data,path,dim,iternum):
column_labels = range(dim)
row_labels = ra... | apache-2.0 |
Statoil/libres | python/res/enkf/export/arg_loader.py | 2 | 1445 | from __future__ import print_function
import math
from pandas import DataFrame, MultiIndex
import numpy
from res.enkf import ErtImplType, EnKFMain, EnkfFs, RealizationStateEnum, GenKwConfig
from res.enkf.plot_data import EnsemblePlotGenData
from ecl.util.util import BoolVector
class ArgLoader(object):
@staticmet... | gpl-3.0 |
zorroblue/scikit-learn | sklearn/svm/tests/test_svm.py | 33 | 35916 | """
Testing for Support Vector Machine module (sklearn.svm)
TODO: remove hard coded numerical results when possible
"""
import numpy as np
import itertools
from numpy.testing import assert_array_equal, assert_array_almost_equal
from numpy.testing import assert_almost_equal
from numpy.testing import assert_allclose
fro... | bsd-3-clause |
davidgbe/scikit-learn | sklearn/cluster/tests/test_mean_shift.py | 150 | 3651 | """
Testing for mean shift clustering methods
"""
import numpy as np
import warnings
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_false
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import asser... | bsd-3-clause |
tylerjereddy/py_sphere_Voronoi | test_voronoi_utility.py | 2 | 29509 | import unittest
import numpy
import numpy.linalg
import numpy.random
import numpy.testing
import scipy
import scipy.spatial
import math
import voronoi_utility
import networkx as nx
import random
import pandas
class Test_delaunay_triangulation_on_sphere_surface(unittest.TestCase):
def setUp(self):
#simple ... | mit |
okadate/romspy | romspy/tplot/tplot_frc.py | 1 | 1292 | # -*- coding: utf-8 -*-
"""
2013/12/17 okada created this file.
2015/05/01 okada remake it.
"""
import netCDF4
import matplotlib.pyplot as plt
import numpy as np
import datetime
from matplotlib.dates import DateFormatter
def tplot_frc(frcfile, figdir, vname):
print frcfile, figdir, vname
n... | mit |
siosio/intellij-community | python/helpers/pydev/_pydev_bundle/pydev_code_executor.py | 10 | 7842 | import sys
import traceback
from _pydev_bundle._pydev_calltip_util import get_description
from _pydev_bundle.pydev_imports import _queue
from _pydev_bundle.pydev_stdin import DebugConsoleStdIn
from _pydevd_bundle import pydevd_vars
# ===================================================================================... | apache-2.0 |
Eric89GXL/expyfun | examples/experiments/tracker_dealer_doublesided.py | 2 | 3623 | # -*- coding: utf-8 -*-
"""
======================================
Adaptive tracking from above and below
======================================
This file shows how to interleave multiple Tracker objects using
:class:`expyfun.stimuli.TrackerDealer` to simultaneously approach a threshold
from both above and bel... | bsd-3-clause |
lbishal/scikit-learn | examples/tree/unveil_tree_structure.py | 67 | 4824 | """
=========================================
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... | bsd-3-clause |
wolfram74/numerical_methods_iserles_notes | venv/lib/python2.7/site-packages/IPython/core/shellapp.py | 4 | 17177 | # encoding: utf-8
"""
A mixin for :class:`~IPython.core.application.Application` classes that
launch InteractiveShell instances, load extensions, etc.
"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import absolute_import
from __future__ import ... | mit |
ewiger/libppm | utils/ppm_dbg/ppm_dbg_cli.py | 2 | 5433 | from mpl_toolkits.mplot3d import Axes3D
from matplotlib.patches import Polygon
from matplotlib.colors import *
import matplotlib.cm as cm
import matplotlib.pyplot as plt
import numpy as np
import sys
# should do it for now, but should be replaced by a generic implementation that
# picks arbitrary number of colors
c... | gpl-3.0 |
dingliumath/quant-econ | examples/stochasticgrowth.py | 7 | 1746 | """
Neoclassical growth model with constant savings rate, where the dynamics are
given by
k_{t+1} = s A_{t+1} f(k_t) + (1 - delta) k_t
Marginal densities are computed using the look-ahead estimator. Thus, the
estimate of the density psi_t of k_t is
(1/n) sum_{i=0}^n p(k_{t-1}^i, y)
This is a density in y.
... | bsd-3-clause |
lo-co/atm-py | build/lib/atmPy/atmos/atmosphere_standards.py | 3 | 2597 | # -*- coding: utf-8 -*-
"""
This module contains atmospheric constands and standards.
@author: Hagen
"""
import numpy as np
import pandas as pd
from scipy.interpolate import interp1d
def standard_atmosphere(value, quantity='altitude', standard='international', return_standard=False):
"""Returns pre... | mit |
ameya30/IMaX_pole_data_scripts | my_scripts/snr_quiet_pulpo.py | 1 | 1119 | import numpy as np
from astropy.io import fits
from matplotlib import pyplot as plt
fima = fits.open('/scratch/prabhu/HollyWaller/IMaX_pole_data_scripts/primary_scripts/saves_Oct11/post_demod_tr2_output_21.fits')[0].data
st = int(input("Choose stokes: "))
stokes = {0:'I',1:'Q',2:'U',3:'V'}
dim = fima.shape
pri... | mit |
snfactory/extract-star | scripts/plot_slices.py | 1 | 11649 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import optparse
import numpy as N
import pySNIFS
from ToolBox.MPL import get_backend, errorband
from ToolBox.ReST import rst_table
from ToolBox.Arrays import metaslice
__author__ = "Yannick Copin <y.copin@ipnl.in2p3.fr>"
__version__ = '$Id$'
parser = optparse.O... | mit |
hakonsbm/nest-simulator | extras/ConnPlotter/tcd_nest.py | 15 | 6952 | # -*- coding: utf-8 -*-
#
# tcd_nest.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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 |
gnu-sandhi/gnuradio | gnuradio-core/src/examples/pfb/chirp_channelize.py | 17 | 6856 | #!/usr/bin/env python
#
# Copyright 2009 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 |
btabibian/scikit-learn | examples/cluster/plot_digits_agglomeration.py | 377 | 1694 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Feature agglomeration
=========================================================
These images how similar features are merged together using
feature agglomeration.
"""
print(__doc__)
# Code source: Gaël Varoquaux
#... | bsd-3-clause |
habi/GlobalDiagnostiX | Analysis/DetectWhichImageIsFocusedBest.py | 1 | 5475 | # -*- coding: utf8 -*-
"""
Script to load a bunch of images and caculate the focus of them, based on the
standard deviation of the gray values. The image with the smallest standard
deviation (from the same scene!) should be the one focused best.
"""
from __future__ import division
import glob
import os
import matplot... | unlicense |
xyguo/scikit-learn | examples/decomposition/plot_incremental_pca.py | 175 | 1974 | """
===============
Incremental PCA
===============
Incremental principal component analysis (IPCA) is typically used as a
replacement for principal component analysis (PCA) when the dataset to be
decomposed is too large to fit in memory. IPCA builds a low-rank approximation
for the input data using an amount of memo... | bsd-3-clause |
gcarq/freqtrade | freqtrade/templates/sample_hyperopt.py | 1 | 8378 | # pragma pylint: disable=missing-docstring, invalid-name, pointless-string-statement
# isort: skip_file
# --- Do not remove these libs ---
from functools import reduce
from typing import Any, Callable, Dict, List
import numpy as np # noqa
import pandas as pd # noqa
from pandas import DataFrame
from skopt.space impo... | gpl-3.0 |
xiaoxiamii/scikit-learn | examples/feature_stacker.py | 246 | 1906 | """
=================================================
Concatenating multiple feature extraction methods
=================================================
In many real-world examples, there are many ways to extract features from a
dataset. Often it is beneficial to combine several methods to obtain good
performance. Th... | bsd-3-clause |
MLWave/auto-sklearn | autosklearn/models/holdout_evaluator.py | 5 | 2302 | from autosklearn.data.split_data import split_data
from autosklearn.models.evaluator import Evaluator, calculate_score
from autosklearn.constants import *
class HoldoutEvaluator(Evaluator):
def __init__(self, Datamanager, configuration, with_predictions=False,
all_scoring_functions=False, seed=1... | bsd-3-clause |
RPGOne/Skynet | scikit-learn-c604ac39ad0e5b066d964df3e8f31ba7ebda1e0e/examples/exercises/plot_cv_diabetes.py | 5 | 2530 | """
===============================================
Cross-validation on diabetes Dataset Exercise
===============================================
A tutorial excercise which uses cross-validation with linear models.
This exercise is used in the :ref:`cv_estimators_tut` part of the
:ref:`model_selection_tut` section of... | bsd-3-clause |
aetilley/scikit-learn | benchmarks/bench_multilabel_metrics.py | 86 | 7286 | #!/usr/bin/env python
"""
A comparison of multilabel target formats and metrics over them
"""
from __future__ import division
from __future__ import print_function
from timeit import timeit
from functools import partial
import itertools
import argparse
import sys
import matplotlib.pyplot as plt
import scipy.sparse as... | bsd-3-clause |
tequa/ammisoft | ammimain/WinPython-64bit-2.7.13.1Zero/python-2.7.13.amd64/Lib/site-packages/matplotlib/text.py | 10 | 82852 | """
Classes for including text in a figure.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
from six.moves import zip
import math
import warnings
import contextlib
import numpy as np
from matplotlib import cbook
from matplotlib import rcPa... | bsd-3-clause |
alessiamarcolini/deepstreet | demo.py | 1 | 5115 | """VGG16 model for Keras.
# Reference
- [Very Deep Convolutional Networks for Large-Scale Image Recognition](https://arxiv.org/abs/1409.1556)
"""
import warnings
from keras.applications import vgg16
from keras.models import Model
from keras import optimizers
from keras.layers import Input
from keras.layers import Conv... | mit |
huahbo/src | user/karl/rsf2numpy4.py | 5 | 1288 | #!/usr/bin/env python
import rsf.api as rsf
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt
import sys
import os
import c_m8r as c_rsf
import m8r
# next challenge is to get input file names from command line
# use Msfin.c as example
print "program name",sys.argv[0]
print "type sys.argv=",type(s... | gpl-2.0 |
pratapvardhan/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 |
dmlc/xgboost | tests/python/testing.py | 1 | 11457 | # coding: utf-8
import os
import urllib
import zipfile
import sys
from contextlib import contextmanager
from io import StringIO
from xgboost.compat import SKLEARN_INSTALLED, PANDAS_INSTALLED
from xgboost.compat import DASK_INSTALLED
import pytest
import tempfile
import xgboost as xgb
import numpy as np
import platform
... | apache-2.0 |
geophysics/mtpy | mtpy/imaging/plotspectrogram.py | 1 | 23346 | # -*- coding: utf-8 -*-
"""
==================
plotft
==================
*PlotTF --> will plot a time frequency distribution of your choice
Created on Mon Aug 19 16:24:29 2013
@author: jpeacock
"""
#=================================================================
import numpy as np
import matplotlib.... | gpl-3.0 |
bjsmith/motivation-simulation | demo_paper_saltrat.py | 1 | 1370 | import matplotlib.pyplot as plt #we might do some other tool later.
from SimulationVisualization import *
__author__ = 'benjaminsmith'
from SetupBaseSaltRatModel import *
#import Tkinter as tk
model1 = setup_base_salt_rat_model()
model1.set_display_settings(tendency_graph_width=6, state_graph_width=8.0)
#first mo... | gpl-3.0 |
sinhrks/scikit-learn | sklearn/mixture/tests/test_dpgmm.py | 261 | 4490 | import unittest
import sys
import numpy as np
from sklearn.mixture import DPGMM, VBGMM
from sklearn.mixture.dpgmm import log_normalize
from sklearn.datasets import make_blobs
from sklearn.utils.testing import assert_array_less, assert_equal
from sklearn.mixture.tests.test_gmm import GMMTester
from sklearn.externals.s... | bsd-3-clause |
potash/scikit-learn | examples/tree/plot_unveil_tree_structure.py | 67 | 4824 | """
=========================================
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... | bsd-3-clause |
MatthieuBizien/scikit-learn | examples/preprocessing/plot_function_transformer.py | 158 | 1993 | """
=========================================================
Using FunctionTransformer to select columns
=========================================================
Shows how to use a function transformer in a pipeline. If you know your
dataset's first principle component is irrelevant for a classification task,
you ca... | bsd-3-clause |
LiaoPan/scikit-learn | examples/applications/wikipedia_principal_eigenvector.py | 233 | 7819 | """
===============================
Wikipedia principal eigenvector
===============================
A classical way to assert the relative importance of vertices in a
graph is to compute the principal eigenvector of the adjacency matrix
so as to assign to each vertex the values of the components of the first
eigenvect... | bsd-3-clause |
kushalbhola/MyStuff | Practice/PythonApplication/env/Lib/site-packages/pandas/tests/tseries/offsets/test_offsets.py | 2 | 158558 | from datetime import date, datetime, time as dt_time, timedelta
import numpy as np
import pytest
from pandas._libs.tslibs import (
NaT,
OutOfBoundsDatetime,
Timestamp,
conversion,
timezones,
)
from pandas._libs.tslibs.frequencies import (
INVALID_FREQ_ERR_MSG,
get_freq_code,
get_freq_s... | apache-2.0 |
schets/scikit-learn | examples/covariance/plot_sparse_cov.py | 300 | 5078 | """
======================================
Sparse inverse covariance estimation
======================================
Using the GraphLasso estimator to learn a covariance and sparse precision
from a small number of samples.
To estimate a probabilistic model (e.g. a Gaussian model), estimating the
precision matrix, t... | bsd-3-clause |
dataplumber/nexus | analysis/webservice/algorithms_spark/TimeSeriesSpark.py | 1 | 24283 | """
Copyright (c) 2016 Jet Propulsion Laboratory,
California Institute of Technology. All rights reserved
"""
import calendar
import itertools
import logging
import traceback
from cStringIO import StringIO
from datetime import datetime
import matplotlib.dates as mdates
import matplotlib.pyplot as plt
import numpy as ... | apache-2.0 |
NelisVerhoef/scikit-learn | sklearn/linear_model/tests/test_least_angle.py | 98 | 20870 | from nose.tools import assert_equal
import numpy as np
from scipy import linalg
from sklearn.cross_validation import train_test_split
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_less
from sklearn.utils.testing impor... | bsd-3-clause |
pprett/scikit-learn | sklearn/ensemble/voting_classifier.py | 11 | 11341 | """
Soft Voting/Majority Rule classifier.
This module contains a Soft Voting/Majority Rule classifier for
classification estimators.
"""
# Authors: Sebastian Raschka <se.raschka@gmail.com>,
# Gilles Louppe <g.louppe@gmail.com>
#
# License: BSD 3 clause
import numpy as np
from ..base import ClassifierMixin... | bsd-3-clause |
arjoly/scikit-learn | sklearn/linear_model/tests/test_sgd.py | 30 | 44274 | 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 |
shusenl/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 |
akionakamura/scikit-learn | examples/cluster/plot_kmeans_assumptions.py | 270 | 2040 | """
====================================
Demonstration of k-means assumptions
====================================
This example is meant to illustrate situations where k-means will produce
unintuitive and possibly unexpected clusters. In the first three plots, the
input data does not conform to some implicit assumptio... | bsd-3-clause |
asnorkin/sentiment_analysis | site/lib/python2.7/site-packages/sklearn/model_selection/_validation.py | 5 | 36967 | """
The :mod:`sklearn.model_selection._validation` module includes classes and
functions to validate the model.
"""
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>,
# Gael Varoquaux <gael.varoquaux@normalesup.org>,
# Olivier Grisel <olivier.grisel@ensta.org>
# License: BSD 3 clause
from __... | mit |
nityas/6869-finalproject | src/lenet2/lenet_38.py | 2 | 13187 | """This tutorial introduces the LeNet5 neural network architecture
using Theano. LeNet5 is a convolutional neural network, good for
classifying images. This tutorial shows how to build the architecture,
and comes with all the hyper-parameters you need to reproduce the
paper's MNIST results.
This implementation simpl... | mit |
Hash--/ICRH | WEST/HFSS_antenna_front_face/generate_dielectric_profile.py | 1 | 1248 | # -*- coding: utf-8 -*-
"""
Generate an equivalent plasma dielectric as eps_r = S - D for a given frequency
"""
#%%
from plasmapy.formulary.dielectric import cold_plasma_permittivity_SDP
import matplotlib.pyplot as plt
import numpy as np
from astropy import units as u
from scipy.constants import pi
#%% Antenna paramete... | mit |
andrescodas/casadi | docs/examples/python/mhe_spring_damper.py | 3 | 9106 | #
# This file is part of CasADi.
#
# CasADi -- A symbolic framework for dynamic optimization.
# Copyright (C) 2010-2014 Joel Andersson, Joris Gillis, Moritz Diehl,
# K.U. Leuven. All rights reserved.
# Copyright (C) 2011-2014 Greg Horn
#
# CasADi is free software; you can... | lgpl-3.0 |
vladsaveliev/bcbio-nextgen | tests/integration/rnaseq/test_ericscript.py | 2 | 4681 | from copy import deepcopy
import functools
import os
import pytest
import pandas as pd
from bcbio.rnaseq import ericscript
from tests.conftest import make_workdir
from bcbio.pipeline import config_utils, run_info
from bcbio.log import setup_script_logging
def create_sample_config(data_dir, work_dir, disambiguate=Fa... | mit |
jseabold/scikit-learn | examples/model_selection/plot_roc_crossval.py | 37 | 3474 | """
=============================================================
Receiver Operating Characteristic (ROC) with cross validation
=============================================================
Example of Receiver Operating Characteristic (ROC) metric to evaluate
classifier output quality using cross-validation.
ROC curv... | bsd-3-clause |
pelagos/paparazzi | sw/airborne/test/stabilization/compare_ref_quat.py | 38 | 1206 | #! /usr/bin/env python
from __future__ import division, print_function, absolute_import
import numpy as np
import matplotlib.pyplot as plt
import ref_quat_float
import ref_quat_int
steps = 512 * 2
ref_eul_res = np.zeros((steps, 3))
ref_quat_res = np.zeros((steps, 3))
ref_quat_float.init()
ref_quat_int.init()
# re... | gpl-2.0 |
kandy-koblenz/people-networks | wikipedia-crawl/profile-reading-reworked.py | 1 | 3776 | import pickle
import pandas as pd
from mwclient import Site
import datetime
import time
import os
import wikitextparser as wtp
import sys
import csv
from create_profile_reading_tracker import create_profile_reading_tracker
#prev_size = 1 #DEBUG checking the size of dict
file_name = 'politician-data'
tracker_file =... | mit |
balazssimon/ml-playground | udemy/lazyprogrammer/supervised-learning-python/dt_without_recursion.py | 1 | 10195 | import numpy as np
from util import get_data, get_xor, get_donut
from datetime import datetime
def entropy(y):
# assume y is binary - 0 or 1
N = len(y)
s1 = (y == 1).sum()
if 0 == s1 or N == s1:
return 0
p1 = float(s1) / N
p0 = 1 - p1
# return -p0*np.log2(p0) - p1*np.log2(p1)
r... | apache-2.0 |
stevenweaver/idepi | idepi/scorer/__init__.py | 4 | 3139 |
from warnings import catch_warnings, simplefilter
from numpy import (
eye,
mean,
prod,
seterr,
zeros
)
from sklearn.metrics import (
confusion_matrix,
matthews_corrcoef
)
__all__ = ['Scorer', 'mcc']
def mcc(*args, **kwargs):
settings = seterr(invalid='ignore')
mcc_ = m... | gpl-3.0 |
saskartt/P4UL | pyFootprint/footprintDiff.py | 1 | 2919 | #!/usr/bin/env python
from utilities import filesFromList
from utilities import writeLog
from plotTools import addContourf, addToPlot
from footprintTools import *
from mapTools import readNumpyZTile, filterAndScale, farFieldIds
import sys
import argparse
import numpy as np
import matplotlib as mpl
import matplotlib.pyp... | mit |
morrislab/rnascan | setup.py | 1 | 2337 | import os.path
import sys
from setuptools import find_packages
from distutils.core import setup, Extension
if sys.version_info < (2, 7):
sys.stderr.write("rnascan requires Python 2.7, or Python 3.5 or later. "
"Python %d.%d detected.\n" % sys.version_info[:2])
sys.exit(1)
elif sys.ve... | agpl-3.0 |
ZenDevelopmentSystems/scikit-learn | examples/applications/plot_out_of_core_classification.py | 255 | 13919 | """
======================================================
Out-of-core classification of text documents
======================================================
This is an example showing how scikit-learn can be used for classification
using an out-of-core approach: learning from data that doesn't fit into main
memory. ... | bsd-3-clause |
jenfly/atmos-tools | testing/testing-data-daily_from_subdaily.py | 1 | 1043 | import xray
import numpy as np
import matplotlib.pyplot as plt
import atmos as atm
from atmos import daily_from_subdaily
datadir = '/home/jwalker/eady/datastore/'
#datadir = '/home/jennifer/datastore/'
# ----------------------------------------------------------------------
# MERRA Daily
filename = datadir + 'merra/d... | mit |
BorisJeremic/Real-ESSI-Examples | analytic_solution/test_cases/Contact/Stress_Based_Contact_Verification/SoftContact_NonLinHardShear/Area/A_1e-2/Normalized_Shear_Stress_Plot.py | 48 | 3533 | #!/usr/bin/python
import h5py
import matplotlib.pylab as plt
import matplotlib as mpl
import sys
import numpy as np;
plt.rcParams.update({'font.size': 28})
# set tick width
mpl.rcParams['xtick.major.size'] = 10
mpl.rcParams['xtick.major.width'] = 5
mpl.rcParams['xtick.minor.size'] = 10
mpl.rcParams['xtick.minor.width... | cc0-1.0 |
waynenilsen/statsmodels | statsmodels/tools/_testing.py | 29 | 4809 | """Testing helper functions
Warning: current status experimental, mostly copy paste
Warning: these functions will be changed without warning as the need
during refactoring arises.
The first group of functions provide consistency checks
"""
import numpy as np
from numpy.testing import assert_allclose, assert_
from ... | bsd-3-clause |
clara-labs/spherecluster | spherecluster/von_mises_fisher_mixture.py | 1 | 31413 | import warnings
import numpy as np
import scipy.sparse as sp
from joblib import Parallel, delayed
from numpy import i0 # modified Bessel function of first kind order 0, I_0
from scipy.special import iv # modified Bessel function of first kind, I_v
from scipy.special import logsumexp
from sklearn.base import BaseEst... | mit |
mcdeoliveira/beaglebone | examples/rc_motor.py | 3 | 3817 | #!/usr/bin/env python3
def main():
# import python's standard math module and numpy
import math, numpy, sys
# import Controller and other blocks from modules
from pyctrl.rc import Controller
from pyctrl.block import Interp, Logger, Constant
from pyctrl.block.system import System, Differen... | apache-2.0 |
larsmans/scikit-learn | sklearn/neighbors/graph.py | 17 | 2841 | """Nearest Neighbors graph functions"""
# Author: Jake Vanderplas <vanderplas@astro.washington.edu>
#
# License: BSD 3 clause (C) INRIA, University of Amsterdam
from .base import KNeighborsMixin, RadiusNeighborsMixin
from .unsupervised import NearestNeighbors
def kneighbors_graph(X, n_neighbors, mode='connectivity'... | bsd-3-clause |
Microsoft/hummingbird | tests/test_onnxml_one_hot_encoder_converter.py | 1 | 4362 | """
Tests onnxml scaler converter
"""
import unittest
import warnings
import numpy as np
from sklearn.preprocessing import OneHotEncoder
import torch
from hummingbird.ml._utils import onnx_ml_tools_installed, onnx_runtime_installed, lightgbm_installed
from hummingbird.ml import convert
if onnx_runtime_installed():
... | mit |
JuLuSi/incflow | tests/test_incns_ghia.py | 1 | 1983 | from os.path import abspath, basename, dirname, join
from firedrake import *
from firedrake.petsc import PETSc
from incflow import *
import pytest
import numpy as np
import matplotlib.pyplot as plt
cwd = abspath(dirname(__file__))
data_dir = join(cwd, "data")
def plot_results(u1, re):
mr = {100: 1, 1000: 2, 3200... | mit |
IDEALLab/domain_expansion_jmd_2017 | exp_hosaki.py | 1 | 7467 | """
Active Domain Expansion for the Hosaki function example
Author(s): Wei Chen (wchen459@umd.edu)
"""
import math
import numpy as np
from sklearn.neighbors import KernelDensity
from sklearn.metrics.pairwise import pairwise_distances
from sklearn.gaussian_process.kernels import RBF
from sklearn.metrics import f1_scor... | mit |
vigilv/scikit-learn | sklearn/datasets/svmlight_format.py | 79 | 15976 | """This module implements a loader and dumper for the svmlight format
This format is a text-based format, with one sample per line. It does
not store zero valued features hence is suitable for sparse dataset.
The first element of each line can be used to store a target variable to
predict.
This format is used as the... | bsd-3-clause |
RichHelle/data-science-from-scratch | scratch/clustering.py | 3 | 10283 | from scratch.linear_algebra import Vector
def num_differences(v1: Vector, v2: Vector) -> int:
assert len(v1) == len(v2)
return len([x1 for x1, x2 in zip(v1, v2) if x1 != x2])
assert num_differences([1, 2, 3], [2, 1, 3]) == 2
assert num_differences([1, 2], [1, 2]) == 0
from typing import List
from scratch.lin... | unlicense |
dsm054/pandas | pandas/tests/dtypes/test_cast.py | 6 | 17619 | # -*- coding: utf-8 -*-
"""
These test the private routines in types/cast.py
"""
import pytest
from datetime import datetime, timedelta, date
import numpy as np
import pandas as pd
from pandas import (Timedelta, Timestamp, DatetimeIndex,
DataFrame, NaT, Period, Series)
from pandas.core.dtypes.c... | bsd-3-clause |
spallavolu/scikit-learn | examples/semi_supervised/plot_label_propagation_digits_active_learning.py | 294 | 3417 | """
========================================
Label Propagation digits active learning
========================================
Demonstrates an active learning technique to learn handwritten digits
using label propagation.
We start by training a label propagation model with only 10 labeled points,
then we select the t... | bsd-3-clause |
aabadie/scikit-learn | examples/plot_compare_reduction.py | 19 | 2489 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=================================================================
Selecting dimensionality reduction with Pipeline and GridSearchCV
=================================================================
This example constructs a pipeline that does dimensionality
reduction follo... | bsd-3-clause |
bsipocz/astropy | astropy/visualization/scripts/tests/test_fits2bitmap.py | 5 | 2342 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import numpy as np
from astropy.io import fits
try:
import matplotlib # pylint: disable=W0611
import matplotlib.image as mpimg
HAS_MATPLOTLIB = True
from astropy.visualization.scripts.fits2bitmap import fits2bitmap, main
e... | bsd-3-clause |
gviejo/ThalamusPhysio | python/figure_article_v2/main_article_fig_supp_5.py | 1 | 5955 | import numpy as np
import pandas as pd
# from matplotlib.pyplot import plot,show,draw
import scipy.io
import sys
sys.path.append("../")
from functions import *
from pylab import *
from sklearn.decomposition import PCA
import _pickle as cPickle
import matplotlib.cm as cm
import os
#####################################... | gpl-3.0 |
zhuhuifeng/PyML | examples/linear_models.py | 1 | 1787 | import logging
try:
from sklearn.model_selection import train_test_split
except ImportError:
from sklearn.cross_validation import train_test_split
from sklearn.datasets import make_classification
from sklearn.datasets import make_regression
from mla.linear_models import LinearRegression, LogisticRegression
fr... | apache-2.0 |
newlawrence/poliastro | docs/source/conf.py | 1 | 9340 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# poliastro documentation build configuration file, created by
# sphinx-quickstart on Sat May 24 11:02:03 2014.
#
# 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
# ... | mit |
giorgiop/scikit-learn | sklearn/mixture/tests/test_dpgmm.py | 84 | 7866 | # Important note for the deprecation cleaning of 0.20 :
# All the function and classes of this file have been deprecated in 0.18.
# When you remove this file please also remove the related files
# - 'sklearn/mixture/dpgmm.py'
# - 'sklearn/mixture/gmm.py'
# - 'sklearn/mixture/test_gmm.py'
import unittest
import sys
imp... | bsd-3-clause |
willcode/gnuradio | gr-dtv/examples/atsc_ctrlport_monitor.py | 4 | 5481 | #!/usr/bin/env python
#
# Copyright 2015 Free Software Foundation
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
import sys
import matplotlib
matplotlib.use("QT4Agg")
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from gnuradio.ctrlport.GNURadioControlPortClient import (
GNURadioControl... | gpl-3.0 |
ajgriesemer/XBeeController | views/graph_view.py | 1 | 2052 | import matplotlib
matplotlib.use('TkAgg')
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
import matplotlib.pyplot
import matplotlib.animation
import numpy
import tkinter
from controllers import xbee
class GraphFrame(tkinter.Frame):
def __init__(self, parent, xbee_controller, max_t=2, delta_t = 0.... | apache-2.0 |
mattilyra/scikit-learn | sklearn/svm/tests/test_svm.py | 29 | 31448 | """
Testing for Support Vector Machine module (sklearn.svm)
TODO: remove hard coded numerical results when possible
"""
import numpy as np
import itertools
from numpy.testing import assert_array_equal, assert_array_almost_equal
from numpy.testing import assert_almost_equal
from scipy import sparse
from nose.tools im... | bsd-3-clause |
NlGG/envelope | envelope.py | 1 | 3825 | #!/usr/bin/python
#-*- encoding: utf-8 -*-
# Quantitative Economics Web: http://quant-econ.net/py/index.html
from __future__ import division
import math
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.animation as animation
def envelope(expression, with_animation=False, **kwargs):
# 可変長キーワ... | bsd-3-clause |
kenshay/ImageScripter | ProgramData/SystemFiles/Python/Lib/site-packages/skimage/future/manual_segmentation.py | 6 | 7110 | from functools import reduce
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.patches import Polygon
from matplotlib.collections import PatchCollection
from ..draw import polygon
LEFT_CLICK = 1
RIGHT_CLICK = 3
def _mask_from_vertices(vertices, shape, label):
mask = np.zeros(s... | gpl-3.0 |
ebilionis/py-mcmc | demos/demo4.py | 2 | 4183 | """
This demo demonstrates how to use a mean function in a GP and allow the model
to discover the most important basis functions.
This model is equivalent to a Relevance Vector Machine.
Author:
Ilias Bilionis
Date:
3/20/2014
"""
import numpy as np
import GPy
import pymcmc as pm
import matplotlib.pyplot as ... | lgpl-3.0 |
uwkejia/Clean-Energy-Outlook | ceo/test_data_cleaning.py | 1 | 9621 | import pandas as pd
import numpy as np
import xlrd
import ceo
from ceo import data_cleaning as dc
import os
import os.path as op
import inspect
#Location for Original Data
data_path = op.join(ceo.__path__[0], 'Data')
data_path = op.join(data_path, 'Original Data')
#Input data
df = pd.read_excel(op.join(data_path, 'Stat... | mit |
aasensio/proxStokesSystematics | doPlotHazel.py | 1 | 4165 | import numpy as np
import matplotlib.pyplot as pl
import seaborn as sn
from ipdb import set_trace as stop
import waveletTrans as wl
import pyiacsun as ps
def plotSingleWavelet(data, row, valueL1):
obs = data['arr_0']
stokes = data['arr_1']
sys = data['arr_2']
chi2 = data['arr_3']
x = data['... | mit |
BMCV/galaxy-image-analysis | tools/points2binaryimage/points2binaryimage.py | 1 | 2480 | import argparse
import sys
import numpy as np
import skimage.io
import pandas as pd
import os
import warnings
def points2binaryimage(point_file, out_file, shape=[500, 500], has_header=False, invert_xy=False):
img = np.zeros(shape, dtype=np.int16)
if os.path.exists(point_file) and os.path.getsize(point_file)... | mit |
krafczyk/spack | var/spack/repos/builtin/packages/py-misopy/package.py | 5 | 2112 | ##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 |
wind-python/windpowerlib | windpowerlib/modelchain.py | 1 | 21440 | """
The ``modelchain`` module contains functions and classes of the
windpowerlib. This module makes it easy to get started with the windpowerlib
and demonstrates standard ways to use the library.
SPDX-FileCopyrightText: 2019 oemof developer group <contact@oemof.org>
SPDX-License-Identifier: MIT
"""
import logging
from... | mit |
walterreade/scikit-learn | sklearn/metrics/cluster/tests/test_supervised.py | 41 | 8901 | import numpy as np
from sklearn.metrics.cluster import adjusted_rand_score
from sklearn.metrics.cluster import homogeneity_score
from sklearn.metrics.cluster import completeness_score
from sklearn.metrics.cluster import v_measure_score
from sklearn.metrics.cluster import homogeneity_completeness_v_measure
from sklearn... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.