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 |
|---|---|---|---|---|---|
nicktimko/multiworm | tapeworm/scoring.py | 1 | 2898 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Generates a scoring function from worm data that can be fed a time and
distance gap to predict connected worm tracks.
"""
from __future__ import (
absolute_import, division, print_function, unicode_literals)
import six
from six.moves import (zip, filter, map, r... | mit |
tedunderwood/fiction | code/modelingprocess.py | 1 | 3093 | # modelingprocess.py
import numpy as np
import pandas as pd
from sklearn.linear_model import LogisticRegression
def remove_zerocols(trainingset, testset):
''' Remove all columns that sum to zero in the trainingset.
'''
columnsums = trainingset.sum(axis = 0)
columnstokeep = []
for i in range(len(c... | mit |
HeraclesHX/scikit-learn | examples/text/mlcomp_sparse_document_classification.py | 292 | 4498 | """
========================================================
Classification of text documents: using a MLComp dataset
========================================================
This is an example showing how the scikit-learn can be used to classify
documents by topics using a bag-of-words approach. This example uses
a s... | bsd-3-clause |
yonglehou/scikit-learn | sklearn/utils/tests/test_random.py | 230 | 7344 | from __future__ import division
import numpy as np
import scipy.sparse as sp
from scipy.misc import comb as combinations
from numpy.testing import assert_array_almost_equal
from sklearn.utils.random import sample_without_replacement
from sklearn.utils.random import random_choice_csc
from sklearn.utils.testing import ... | bsd-3-clause |
rfdougherty/dipy | doc/examples/reconst_dti.py | 5 | 9303 | """
============================================================
Reconstruction of the diffusion signal with the Tensor model
============================================================
The diffusion tensor model is a model that describes the diffusion within a
voxel. First proposed by Basser and colleagues [Basser1... | bsd-3-clause |
ZhiangChen/bendix_dnn | front_radar/logistic_regression.py | 1 | 3546 | #!/usr/bin/env python
from six.moves import cPickle as pickle
import matplotlib.pyplot as plt
import os
import tensorflow as tf
import numpy as np
'''Load Data'''
wd = os.getcwd()
file_name = wd+'/front_dist_data'
with open(file_name, 'rb') as f:
save = pickle.load(f)
pos_data = save['pos_data']
neg_data ... | mit |
QISKit/qiskit-sdk-py | qiskit/visualization/__init__.py | 1 | 2063 | # -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2018.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... | apache-2.0 |
nrhine1/scikit-learn | sklearn/cluster/tests/test_dbscan.py | 176 | 12155 | """
Tests for DBSCAN clustering algorithm
"""
import pickle
import numpy as np
from scipy.spatial import distance
from scipy import sparse
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing im... | bsd-3-clause |
kenshay/ImageScript | ProgramData/SystemFiles/Python/Lib/site-packages/matplotlib/animation.py | 6 | 57798 | # TODO:
# * Loop Delay is broken on GTKAgg. This is because source_remove() is not
# working as we want. PyGTK bug?
# * Documentation -- this will need a new section of the User's Guide.
# Both for Animations and just timers.
# - Also need to update http://www.scipy.org/Cookbook/Matplotlib/Animations
# * Blit
... | gpl-3.0 |
nelsonag/openmc | tests/regression_tests/mgxs_library_nuclides/test.py | 6 | 2524 | import hashlib
import openmc
import openmc.mgxs
from openmc.examples import pwr_pin_cell
from tests.testing_harness import PyAPITestHarness
class MGXSTestHarness(PyAPITestHarness):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# Initialize a two-group structure
... | mit |
herilalaina/scikit-learn | sklearn/neighbors/classification.py | 15 | 14338 | """Nearest Neighbor Classification"""
# Authors: Jake Vanderplas <vanderplas@astro.washington.edu>
# Fabian Pedregosa <fabian.pedregosa@inria.fr>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Sparseness support by Lars Buitinck
# Multi-output support by Arnaud Joly <a.joly@ul... | bsd-3-clause |
vkscool/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/contour.py | 69 | 42063 | """
These are classes to support contour plotting and
labelling for the axes class
"""
from __future__ import division
import warnings
import matplotlib as mpl
import numpy as np
from numpy import ma
import matplotlib._cntr as _cntr
import matplotlib.path as path
import matplotlib.ticker as ticker
import matplotlib.cm... | gpl-3.0 |
drallensmith/neat-python | examples/xor/visualize.py | 2 | 5979 | from __future__ import print_function
import copy
import warnings
import graphviz
import matplotlib.pyplot as plt
import numpy as np
def plot_stats(statistics, ylog=False, view=False, filename='avg_fitness.svg'):
""" Plots the population's average and best fitness. """
if plt is None:
warnings.warn(... | bsd-3-clause |
rth/PyAbel | examples/example_direct_gaussian.py | 2 | 1468 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import matplotlib.pyplot as plt
from time import time
import sys
from abel.direct import direct_transform
from abel.tools.analytical import Gaus... | mit |
ZENGXH/scikit-learn | sklearn/datasets/species_distributions.py | 198 | 7923 | """
=============================
Species distribution dataset
=============================
This dataset represents the geographic distribution of species.
The dataset is provided by Phillips et. al. (2006).
The two species are:
- `"Bradypus variegatus"
<http://www.iucnredlist.org/apps/redlist/details/3038/0>`_... | bsd-3-clause |
VIP-LES/Data-Analysis | Serial_analysis.py | 1 | 4211 | # -*- coding: utf-8 -*-
"""
Created on Fri Oct 4 10:50:25 2019
@author: Richard
"""
import numpy as np
import matplotlib.pyplot as plt
import scipy as sp
import pandas as pd
import pynmea2
def get_sec(time): #helper function to convert serial output time string into int, just for testing convenience
"""Get Seco... | mit |
pkruskal/scikit-learn | benchmarks/bench_plot_svd.py | 325 | 2899 | """Benchmarks of Singular Value Decomposition (Exact and Approximate)
The data is mostly low rank but is a fat infinite tail.
"""
import gc
from time import time
import numpy as np
from collections import defaultdict
from scipy.linalg import svd
from sklearn.utils.extmath import randomized_svd
from sklearn.datasets.s... | bsd-3-clause |
arvindks/kle | covariance/hmatrix/vis.py | 1 | 5903 | from tree import *
#Plotting functions
from matplotlib import pyplot as plt
from matplotlib import cm
from matplotlib.patches import Rectangle as rect
from matplotlib.collections import PatchCollection
import numpy as np
#Functions to visualize clusters in 2D
def VisualizeCluster2D(node, maxlevels, ax):
if node.lev... | gpl-3.0 |
asnorkin/sentiment_analysis | site/lib/python2.7/site-packages/sklearn/feature_selection/__init__.py | 140 | 1302 | """
The :mod:`sklearn.feature_selection` module implements feature selection
algorithms. It currently includes univariate filter selection methods and the
recursive feature elimination algorithm.
"""
from .univariate_selection import chi2
from .univariate_selection import f_classif
from .univariate_selection import f_... | mit |
murali-munna/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 |
thomasaarholt/hyperspy | hyperspy/drawing/_widgets/scalebar.py | 4 | 5335 | # -*- coding: utf-8 -*-
# Copyright 2007-2020 The HyperSpy developers
#
# This file is part of HyperSpy.
#
# HyperSpy 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... | gpl-3.0 |
ml-lab/neon | neon/diagnostics/visualize_rnn.py | 4 | 6174 | # ----------------------------------------------------------------------------
# Copyright 2014 Nervana Systems 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.o... | apache-2.0 |
UUDigitalHumanitieslab/timealign | stats/management/commands/scenario_to_feather.py | 1 | 2735 | # -*- coding: utf-8 -*-
import pandas as pd
import pyarrow.feather as feather
from django.core.management.base import BaseCommand, CommandError
from annotations.models import TenseCategory, Fragment
from stats.models import Scenario
from stats.utils import prepare_label_cache, get_label_properties_from_cache
class ... | mit |
dspaccapeli/bus-arrival | visualization/plot_delay_evo.py | 1 | 1979 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Description:
Plot the delay evolution during a run
for multiple ones having the run_time
(in seconds) shown on the X axis.
@author: dspaccapeli
"""
#imports to manage the sql db
import sqlite3 as lite
import pandas as pd
#to make the plot show-up from command l... | gpl-3.0 |
TomAugspurger/pandas | pandas/tests/indexes/period/test_constructors.py | 1 | 19876 | import numpy as np
import pytest
from pandas._libs.tslibs.period import IncompatibleFrequency
from pandas.core.dtypes.dtypes import PeriodDtype
import pandas as pd
from pandas import (
Index,
NaT,
Period,
PeriodIndex,
Series,
date_range,
offsets,
period_range,
)
import pandas._testing... | bsd-3-clause |
h2educ/scikit-learn | examples/svm/plot_svm_kernels.py | 329 | 1971 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
SVM-Kernels
=========================================================
Three different types of SVM-Kernels are displayed below.
The polynomial and RBF are especially useful when the
data-points are not linearly sep... | bsd-3-clause |
dcherian/pyroms | examples/Beaufort/make_ice_bdry_file.py | 1 | 1686 | import matplotlib
matplotlib.use('Agg')
import subprocess
from multiprocessing import Pool
import pyroms
import pyroms_toolbox
src_varname = ['aice','hice','tisrf','snow_thick', \
'ti','uice', 'vice']
src_sigma = ['sig11', 'sig22', 'sig12']
irange=(420,580)
jrange=(470,570)
#irange = None
#jrange = No... | bsd-3-clause |
dmargala/qusp | examples/plot_stacks.py | 1 | 4076 | #!/usr/bin/env python
import h5py
import qusp
import argparse
import numpy as np
import matplotlib.pyplot as plt
import scipy.signal
def plot_stack(stack, **kwargs):
wavelength = stack['wavelength'].value
flux_wmean = stack['flux_wmean'].value
weight_sum = stack['weight_sum'].value
ntargets = stack.... | mit |
numenta/htmresearch | projects/sequence_prediction/discrete_sequences/plotRepeatedPerturbExperiment.py | 6 | 14424 | #!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2015, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions ... | agpl-3.0 |
cpcloud/pepdata | pepdata/imma2.py | 1 | 2702 | # Copyright (c) 2014. Mount Sinai School of Medicine
#
# 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 o... | apache-2.0 |
sorgerlab/indra | indra/belief/skl.py | 3 | 22060 | import pickle
import logging
import numpy as np
import pandas as pd
from collections import Counter
from typing import Union, Sequence, Optional, List
from sklearn.base import BaseEstimator
from indra.statements import Evidence, Statement, get_all_descendants
from indra.belief import BeliefScorer, check_extra_evidence,... | bsd-2-clause |
nagyistoce/devide | module_kits/matplotlib_kit/__init__.py | 7 | 2895 | # $Id: __init__.py 1945 2006-03-05 01:06:37Z cpbotha $
# importing this module shouldn't directly cause other large imports
# do large imports in the init() hook so that you can call back to the
# ModuleManager progress handler methods.
"""matplotlib_kit package driver file.
Inserts the following modules in sys.modu... | bsd-3-clause |
colspan/wikipedia-ja-word2vec | utils.py | 1 | 2094 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import MeCab
# from pyknp import Jumanpp
class MecabSplitter:
"""
Mecabを使って単語列(原形)を取得する
https://github.com/katryo/tfidf_with_sklearn/blob/master/utils.py
"""
def __init__(self):
self.m = MeCab.Tagger("mecabrc")
def split(self, sentence)... | mit |
vkscool/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/backends/__init__.py | 72 | 2225 |
import matplotlib
import inspect
import warnings
# ipython relies on interactive_bk being defined here
from matplotlib.rcsetup import interactive_bk
__all__ = ['backend','show','draw_if_interactive',
'new_figure_manager', 'backend_version']
backend = matplotlib.get_backend() # validates, to match all_bac... | gpl-3.0 |
wanggang3333/scikit-learn | examples/linear_model/plot_ransac.py | 250 | 1673 | """
===========================================
Robust linear model estimation using RANSAC
===========================================
In this example we see how to robustly fit a linear model to faulty data using
the RANSAC algorithm.
"""
import numpy as np
from matplotlib import pyplot as plt
from sklearn import ... | bsd-3-clause |
alexmojaki/odo | odo/backends/aws.py | 3 | 9445 | from __future__ import print_function, division, absolute_import
import os
import uuid
import zlib
import re
from contextlib import contextmanager
from collections import Iterator
from operator import attrgetter
import pandas as pd
from toolz import memoize, first
from .. import (discover, CSV, resource, append, co... | bsd-3-clause |
PrashntS/scikit-learn | examples/tree/plot_tree_regression_multioutput.py | 206 | 1800 | """
===================================================================
Multi-output Decision Tree Regression
===================================================================
An example to illustrate multi-output regression with decision tree.
The :ref:`decision trees <tree>`
is used to predict simultaneously the ... | bsd-3-clause |
quantumjot/PyFolding | pyfolding/ising.py | 1 | 33738 | #!/usr/bin/env python
"""
Python implementation of common model fitting operations to
analyse protein folding data. Simply automates some fitting
and value calculation. Will be extended to include phi-value
analysis and other common calculations.
Allows for quick model evaluation and plotting.
Also tried to make thi... | mit |
gbrammer/eazy-py | eazy/templates.py | 1 | 48223 | import os
import warnings
from collections import OrderedDict
import numpy as np
import astropy.units as u
from astropy.utils.exceptions import AstropyWarning, AstropyUserWarning
from . import utils
__all__ = ["TemplateError", "Template", "Redden", "ModifiedBlackBody",
"read_templates_file", "load_phoen... | mit |
kubeflow/pipelines | samples/contrib/e2e-outlier-drift-explainer/kfserving/kfserving_e2e_adult.kale.default.py | 2 | 51853 | import kfp.dsl as dsl
import json
import kfp.components as comp
from collections import OrderedDict
from kubernetes import client as k8s_client
def setup(MINIO_ACCESS_KEY: str, MINIO_HOST: str, MINIO_MODEL_BUCKET: str, MINIO_SECRET_KEY: str):
pipeline_parameters_block = '''
MINIO_ACCESS_KEY = "{}"
MINIO_H... | apache-2.0 |
joewandy/keras-molecules | sample_gen.py | 3 | 4651 | from __future__ import print_function
import argparse
import os
import h5py
import numpy as np
import sys
from molecules.model import MoleculeVAE
from molecules.utils import one_hot_array, one_hot_index, from_one_hot_array, \
decode_smiles_from_indexes, load_dataset
from molecules.vectorizer import SmilesDataGene... | mit |
andaag/scikit-learn | benchmarks/bench_plot_nmf.py | 206 | 5890 | """
Benchmarks of Non-Negative Matrix Factorization
"""
from __future__ import print_function
from collections import defaultdict
import gc
from time import time
import numpy as np
from scipy.linalg import norm
from sklearn.decomposition.nmf import NMF, _initialize_nmf
from sklearn.datasets.samples_generator import... | bsd-3-clause |
jmcq89/megaman | megaman/embedding/base.py | 4 | 5249 | """ base estimator class for megaman """
# Author: James McQueen -- <jmcq@u.washington.edu>
# LICENSE: Simplified BSD https://github.com/mmp2/megaman/blob/master/LICENSE
import numpy as np
from scipy.sparse import isspmatrix
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.utils.validation impo... | bsd-2-clause |
DSLituiev/scikit-learn | examples/semi_supervised/plot_label_propagation_structure.py | 45 | 2433 | """
==============================================
Label Propagation learning a complex structure
==============================================
Example of LabelPropagation learning a complex internal structure
to demonstrate "manifold learning". The outer circle should be
labeled "red" and the inner circle "blue". Be... | bsd-3-clause |
tensorflow/graphics | tensorflow_graphics/projects/points_to_3Dobjects/train_multi_objects/train.py | 1 | 43750 | # Copyright 2020 The TensorFlow Authors
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | apache-2.0 |
jayflo/scikit-learn | sklearn/metrics/classification.py | 28 | 67703 | """Metrics to assess performance on classification task given classe 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.gram... | bsd-3-clause |
xiaoxiamii/scikit-learn | sklearn/cluster/__init__.py | 364 | 1228 | """
The :mod:`sklearn.cluster` module gathers popular unsupervised clustering
algorithms.
"""
from .spectral import spectral_clustering, SpectralClustering
from .mean_shift_ import (mean_shift, MeanShift,
estimate_bandwidth, get_bin_seeds)
from .affinity_propagation_ import affinity_propagati... | bsd-3-clause |
amozie/amozie | studzie/keras_rl_agent/cem_test.py | 1 | 1653 | import numpy as np
import matplotlib.pyplot as plt
import gym
import time
from prettytable import PrettyTable
import copy
from keras.models import Sequential, Model
from keras.layers import Dense, Activation, Flatten, Lambda, Input, Reshape, concatenate
from keras.optimizers import Adam, RMSprop
from keras import back... | apache-2.0 |
ReganBell/QReview | networkx/readwrite/gml.py | 8 | 13246 | # encoding: utf-8
"""
Read graphs in GML format.
"GML, the G>raph Modelling Language, is our proposal for a portable
file format for graphs. GML's key features are portability, simple
syntax, extensibility and flexibility. A GML file consists of a
hierarchical key-value lists. Graphs can be annotated with arbitrary
da... | bsd-3-clause |
wesm/ibis | scripts/test_data_admin.py | 1 | 19292 | #! /usr/bin/env python
# Copyright 2015 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 a... | apache-2.0 |
yufeldman/arrow | python/testing/parquet_interop.py | 6 | 1734 | # 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 |
brodoll/sms-tools | software/models_interface/sprModel_function.py | 18 | 3422 | # function to call the main analysis/synthesis functions in software/models/sprModel.py
import numpy as np
import matplotlib.pyplot as plt
import os, sys
from scipy.signal import get_window
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../models/'))
import utilFunctions as UF
import sprMod... | agpl-3.0 |
jdrumgoole/advancedaggregation | grapher.py | 1 | 2778 | '''
@author: jdrumgoole
'''
age=[]
reliability=[]
labels = []
colours = []
from matplotlib import pyplot as pyplot
def graphAvgPassesAge( collection ):
'''
for collections like this:
{u'_id': {u'age': 39.0, u'make': u'MERCEDES-BENZ'},
u'count': 2,
u'miles': 209459.0,
u'passes': 2}
... | agpl-3.0 |
NikNitro/Python-iBeacon-Scan | sympy/external/importtools.py | 20 | 7627 | """Tools to assist importing optional external modules."""
from __future__ import print_function, division
import sys
from distutils.version import StrictVersion
# Override these in the module to change the default warning behavior.
# For example, you might set both to False before running the tests so that
# warning... | gpl-3.0 |
yavalvas/yav_com | build/matplotlib/lib/matplotlib/tests/test_contour.py | 10 | 6418 | from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
import datetime
import numpy as np
from matplotlib import mlab
from matplotlib.testing.decorators import cleanup, image_comparison
from matplotlib import pyplot as plt
import re
@cleanup
def tes... | mit |
Srisai85/scikit-learn | examples/covariance/plot_mahalanobis_distances.py | 348 | 6232 | r"""
================================================================
Robust covariance estimation and Mahalanobis distances relevance
================================================================
An example to show covariance estimation with the Mahalanobis
distances on Gaussian distributed data.
For Gaussian dis... | bsd-3-clause |
mhdella/data-science-from-scratch | code/neural_networks.py | 54 | 6622 | from __future__ import division
from collections import Counter
from functools import partial
from linear_algebra import dot
import math, random
import matplotlib
import matplotlib.pyplot as plt
def step_function(x):
return 1 if x >= 0 else 0
def perceptron_output(weights, bias, x):
"""returns 1 if the percep... | unlicense |
shogun-toolbox/shogun | examples/undocumented/python/graphical/so_multiclass_BMRM.py | 1 | 2678 | #!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
import shogun as sg
def fill_data(cnt, minv, maxv):
x1 = np.linspace(minv, maxv, cnt)
a, b = np.meshgrid(x1, x1)
X = np.array((np.ravel(a), np.ravel(b)))
y = np.zeros((1, cnt*cnt))
tmp = cnt*cnt;
y[0, tmp/3:(tmp/3)*2]=1
y[0, tmp/3*2:(tmp... | bsd-3-clause |
TomAugspurger/pandas | pandas/tests/frame/methods/test_pop.py | 2 | 1226 | from pandas import DataFrame, Series
import pandas._testing as tm
class TestDataFramePop:
def test_pop(self, float_frame):
float_frame.columns.name = "baz"
float_frame.pop("A")
assert "A" not in float_frame
float_frame["foo"] = "bar"
float_frame.pop("foo")
assert ... | bsd-3-clause |
albertzl/artisan | setup-win.py | 9 | 5267 | """
This is a set up script for py2exe
USAGE: python setup-win py2exe
"""
from distutils.core import setup
import matplotlib as mpl
import py2exe
import os
# Remove the build folder, a bit slower but ensures that build contains the latest
import shutil
shutil.rmtree("build", ignore_errors=True)
shu... | gpl-3.0 |
kiyoto/statsmodels | statsmodels/graphics/tests/test_gofplots.py | 27 | 6814 | import numpy as np
from numpy.testing import dec
import statsmodels.api as sm
from statsmodels.graphics.gofplots import qqplot, qqline, ProbPlot
from scipy import stats
try:
import matplotlib.pyplot as plt
import matplotlib
have_matplotlib = True
except ImportError:
have_matplotlib = False
class Ba... | bsd-3-clause |
mehdidc/scikit-learn | sklearn/metrics/pairwise.py | 10 | 41636 | # -*- coding: utf-8 -*-
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Mathieu Blondel <mathieu@mblondel.org>
# Robert Layton <robertlayton@gmail.com>
# Andreas Mueller <amueller@ais.uni-bonn.de>
# Philippe Gervais <philippe.gervais@inria.fr>
# Lars Buitinck ... | bsd-3-clause |
jmetzen/scikit-learn | sklearn/__check_build/__init__.py | 345 | 1671 | """ Module to give helpful messages to the user that did not
compile the scikit properly.
"""
import os
INPLACE_MSG = """
It appears that you are importing a local scikit-learn source tree. For
this, you need to have an inplace install. Maybe you are in the source
directory and you need to try from another location.""... | bsd-3-clause |
umuzungu/zipline | zipline/utils/tradingcalendar_tse.py | 17 | 10125 | #
# Copyright 2014 Quantopian, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | apache-2.0 |
rajat1994/scikit-learn | sklearn/svm/tests/test_bounds.py | 280 | 2541 | import nose
from nose.tools import assert_equal, assert_true
from sklearn.utils.testing import clean_warning_registry
import warnings
import numpy as np
from scipy import sparse as sp
from sklearn.svm.bounds import l1_min_c
from sklearn.svm import LinearSVC
from sklearn.linear_model.logistic import LogisticRegression... | bsd-3-clause |
xubenben/scikit-learn | sklearn/covariance/robust_covariance.py | 198 | 29735 | """
Robust location and covariance estimators.
Here are implemented estimators that are resistant to outliers.
"""
# Author: Virgile Fritsch <virgile.fritsch@inria.fr>
#
# License: BSD 3 clause
import warnings
import numbers
import numpy as np
from scipy import linalg
from scipy.stats import chi2
from . import empir... | bsd-3-clause |
beiko-lab/gengis | bin/Lib/site-packages/matplotlib/backends/backend_gtk3cairo.py | 6 | 1874 | import backend_gtk3
import backend_cairo
from matplotlib.figure import Figure
class RendererGTK3Cairo(backend_cairo.RendererCairo):
def set_context(self, ctx):
self.gc.ctx = ctx
class FigureCanvasGTK3Cairo(backend_gtk3.FigureCanvasGTK3,
backend_cairo.FigureCanvasCairo):
de... | gpl-3.0 |
NelisVerhoef/scikit-learn | examples/plot_kernel_ridge_regression.py | 230 | 6222 | """
=============================================
Comparison of kernel ridge regression and SVR
=============================================
Both kernel ridge regression (KRR) and SVR learn a non-linear function by
employing the kernel trick, i.e., they learn a linear function in the space
induced by the respective k... | bsd-3-clause |
plang85/rough_surfaces | rough_surfaces/plot.py | 1 | 2368 | import numpy as np
from matplotlib import rcParams
import scipy.stats as scst
# TODO get rid of these and we won't need matplotlib in the setup, only for examples
rcParams['font.size'] = 14
rcParams['legend.fontsize'] = 10
rcParams['savefig.dpi'] = 300
rcParams['legend.loc'] = 'upper right'
rcParams['image.cmap'] = 'ho... | mit |
churchlab/ulutil | bin/fasta2lenhist.py | 1 | 2015 | #! /usr/bin/env python
# Copyright 2014 Uri Laserson
#
# 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 o... | apache-2.0 |
lthurlow/Network-Grapher | proj/external/matplotlib-1.2.1/lib/mpl_examples/event_handling/lasso_demo.py | 9 | 2365 | """
Show how to use a lasso to select a set of points and get the indices
of the selected points. A callback is used to change the color of the
selected points
This is currently a proof-of-concept implementation (though it is
usable as is). There will be some refinement of the API.
"""
from matplotlib.widgets import... | mit |
harisbal/pandas | pandas/tests/computation/test_compat.py | 8 | 1370 | import pytest
from distutils.version import LooseVersion
import pandas as pd
from pandas.core.computation.engines import _engines
import pandas.core.computation.expr as expr
from pandas.core.computation.check import _MIN_NUMEXPR_VERSION
def test_compat():
# test we have compat with our version of nu
from p... | bsd-3-clause |
msrconsulting/atm-py | build/lib/atmPy/for_removal/piccolo/piccolo.py | 6 | 2754 | # -*- coding: utf-8 -*-
"""
@author: Hagen Telg
"""
import numpy as np
import pandas as pd
from atmPy.atmos import timeseries
from atmPy.tools import time_tools
def _drop_some_columns(data):
data.drop('Clock', axis=1, inplace=True)
data.drop('Year', axis=1, inplace=True)
data.drop('Month'... | mit |
ryfeus/lambda-packs | Tensorflow_Pandas_Numpy/source3.6/pandas/io/formats/excel.py | 3 | 24272 | """Utilities for conversion to writer-agnostic Excel representation
"""
import re
import warnings
import itertools
import numpy as np
from pandas.compat import reduce
from pandas.io.formats.css import CSSResolver, CSSWarning
from pandas.io.formats.printing import pprint_thing
import pandas.core.common as com
from pa... | mit |
johankaito/fufuka | microblog/flask/venv/lib/python2.7/site-packages/scipy/signal/waveforms.py | 17 | 14814 | # Author: Travis Oliphant
# 2003
#
# Feb. 2010: Updated by Warren Weckesser:
# Rewrote much of chirp()
# Added sweep_poly()
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy import asarray, zeros, place, nan, mod, pi, extract, log, sqrt, \
exp, cos, sin, polyval, po... | apache-2.0 |
msparapa/das | examples/OptimalControl/TitanII/TitanII.py | 1 | 13454 | from das.optimalcontrol.optimalcontrol import *
from das.bvpsol import bvp, Collocation, Shooting
import numpy as np
from math import cos, sin, atan, sqrt
from matplotlib import pyplot as pyplot
from das.utils.keyboard import keyboard
from numba import jit
import time
import copy
shooting_solver = Shooting()
bvp_solve... | gpl-3.0 |
saiwing-yeung/scikit-learn | benchmarks/bench_plot_lasso_path.py | 84 | 4005 | """Benchmarks of Lasso regularization path computation using Lars and CD
The input data is mostly low rank but is a fat infinite tail.
"""
from __future__ import print_function
from collections import defaultdict
import gc
import sys
from time import time
import numpy as np
from sklearn.linear_model import lars_pat... | bsd-3-clause |
jonathandunn/c2xg | c2xg/c2xg.py | 1 | 34387 | import os
import random
import numpy as np
import pandas as pd
import copy
import operator
import pickle
import codecs
from collections import defaultdict
import multiprocessing as mp
import cytoolz as ct
from functools import partial
from pathlib import Path
from cleantext import clean
try :
from .modules.En... | gpl-3.0 |
huzq/scikit-learn | benchmarks/bench_hist_gradient_boosting_higgsboson.py | 12 | 4210 | from urllib.request import urlretrieve
import os
from gzip import GzipFile
from time import time
import argparse
import numpy as np
import pandas as pd
from joblib import Memory
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score, roc_auc_score
# To use this experimental fea... | bsd-3-clause |
UASLab/ImageAnalysis | scripts/sandbox/99-sentera-five-channel4.py | 1 | 20714 | #!/usr/bin/python3
import argparse
import cv2
import math
import numpy as np
import os
import pyexiv2 # dnf install python3-exiv2 (py3exiv2)
from tqdm import tqdm
import matplotlib.pyplot as plt
from props import root, getNode
import props_json
from lib import camera
from lib import image
parser = ... | mit |
tkarna/cofs | test/pressure_grad/test_int_pg_mes.py | 1 | 7608 | """
Unit tests for computing the internal pressure gradient
Runs MES convergence tests against a non-trivial analytical solution in a
deformed geometry.
P1DGxP2 space yields 1st order convergence. For second order convergence both
the scalar fields and its gradient must be in P2DGxP2 space.
"""
from thetis import *
f... | mit |
sarunya-w/CS402-PROJECT | Project/web/web/fftengine.py | 1 | 2145 | # -*- coding: utf-8 -*-
"""
Created on Mon Apr 27 17:31:34 2015
@author: Sarunya
"""
import sys
import numpy as np
from PIL import Image
from matplotlib import pyplot as plt
import scipy.ndimage
sys.setrecursionlimit(10000)
bs = 200
wd = 8 # theta_range=wd*wd*2
clmax = 11 #clmax is amount of class
def normFFT(imag... | mit |
Kate-Willett/HadISDH_Marine_Build | ANALYSIS_PLOTS/PlotObsCount_APR2015.py | 1 | 61152 | #!/usr/local/sci/bin/python
# PYTHON2.7
#
# Author: Kate Willett
# Created: 23 April 2016
# Last update: 23 April 2016
# Location: /data/local/hadkw/HADCRUH2/MARINE/EUSTACEMDS/ANALYSIS_PLOTS/
# GitHub: https://github.com/Kate-Willett/HadISDH_Marine_Build/
# -----------------------
# CODE PURPOSE AND OUTPUT
# ----... | cc0-1.0 |
raymondxyang/tensorflow | tensorflow/contrib/learn/python/learn/learn_io/data_feeder_test.py | 71 | 12923 | # 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 |
nixingyang/Kaggle-Competitions | Customer Satisfaction/ensemble.py | 3 | 1660 | import file_operations
import glob
import numpy as np
import os
import pandas as pd
import solution
import time
OLD_SUBMISSION_FOLDER_PATH = solution.SUBMISSION_FOLDER_PATH
NEW_SUBMISSION_FOLDER_PATH = "./"
def perform_ensembling(low_threshold, high_threshold):
print("Reading the submission files from disk ...")... | mit |
kmather73/zipline | zipline/gens/tradesimulation.py | 9 | 15130 | #
# Copyright 2014 Quantopian, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | apache-2.0 |
chugunovyar/factoryForBuild | env/lib/python2.7/site-packages/scipy/integrate/quadrature.py | 33 | 28087 | from __future__ import division, print_function, absolute_import
import numpy as np
import math
import warnings
# trapz is a public function for scipy.integrate,
# even though it's actually a numpy function.
from numpy import trapz
from scipy.special.orthogonal import p_roots
from scipy.special import gammaln
from sc... | gpl-3.0 |
aabadie/scikit-learn | examples/calibration/plot_compare_calibration.py | 82 | 5012 | """
========================================
Comparison of Calibration of Classifiers
========================================
Well calibrated classifiers are probabilistic classifiers for which the output
of the predict_proba method can be directly interpreted as a confidence level.
For instance a well calibrated (bi... | bsd-3-clause |
cbmoore/statsmodels | statsmodels/sandbox/examples/try_multiols.py | 33 | 1243 | # -*- coding: utf-8 -*-
"""
Created on Sun May 26 13:23:40 2013
Author: Josef Perktold, based on Enrico Giampieri's multiOLS
"""
#import numpy as np
import pandas as pd
import statsmodels.api as sm
from statsmodels.sandbox.multilinear import multiOLS, multigroup
data = sm.datasets.longley.load_pandas()
df = data.e... | bsd-3-clause |
embotech/forcesnlp-examples | path_planning/ipopt/pathplanning_code_generation.py | 1 | 4569 | import sys
sys.path.append(r"/home/andrea/casadi-py27-np1.9.1-v2.4.3")
from casadi import *
from numpy import *
from scipy.linalg import *
import matplotlib
matplotlib.use('Qt4Agg')
import matplotlib.pyplot as plt
from math import atan2, asin
import pdb
from os import system
N = 50 # Control discretization
T = 5.... | mit |
lucamassarelli/AMFC-BRCT | classification/ConfnormalPrediction.py | 1 | 4024 | from Logger import Logger;
import numpy as np
import os;
import pickle
import random
from sklearn.metrics import confusion_matrix
from sklearn.metrics import accuracy_score
from sklearn.metrics import recall_score
from sklearn.metrics import precision_score
from sklearn.metrics import f1_score
from sklearn.feature_sele... | gpl-3.0 |
erh3cq/hyperspy | hyperspy/_signals/signal2d.py | 2 | 35822 | # -*- coding: utf-8 -*-
# Copyright 2007-2020 The HyperSpy developers
#
# This file is part of HyperSpy.
#
# HyperSpy 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... | gpl-3.0 |
eerwitt/tensorflow | tensorflow/examples/learn/hdf5_classification.py | 60 | 2190 | # 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 appl... | apache-2.0 |
amosonn/distributed | distributed/sizeof.py | 2 | 1407 | from __future__ import print_function, division, absolute_import
import sys
from .compatibility import singledispatch
from .utils import ignoring
try: # PyPy does not support sys.getsizeof
sys.getsizeof(1)
getsizeof = sys.getsizeof
except: # Monkey patch
getsizeof = lambda x: 100
@singledispatch
def si... | bsd-3-clause |
ishank08/scikit-learn | examples/ensemble/plot_gradient_boosting_regression.py | 87 | 2510 | """
============================
Gradient Boosting regression
============================
Demonstrate Gradient Boosting on the Boston housing dataset.
This example fits a Gradient Boosting model with least squares loss and
500 regression trees of depth 4.
"""
print(__doc__)
# Author: Peter Prettenhofer <peter.prett... | bsd-3-clause |
sinhrks/scikit-learn | examples/applications/svm_gui.py | 287 | 11161 | """
==========
Libsvm GUI
==========
A simple graphical frontend for Libsvm mainly intended for didactic
purposes. You can create data points by point and click and visualize
the decision region induced by different kernels and parameter settings.
To create positive examples click the left mouse button; to create
neg... | bsd-3-clause |
cpcloud/ibis | ibis/sql/postgres/tests/test_functions.py | 1 | 47668 | import operator
import os
import string
import warnings
from datetime import date, datetime
import numpy as np
import pandas as pd
import pandas.util.testing as tm
import pytest
from pytest import param
import ibis
import ibis.config as config
import ibis.expr.datatypes as dt
import ibis.expr.types as ir
from ibis im... | apache-2.0 |
hammerlab/mhcflurry | test/test_class1_presentation_predictor.py | 1 | 14358 | import logging
logging.getLogger('tensorflow').disabled = True
logging.getLogger('matplotlib').disabled = True
import pandas
import tempfile
import pickle
from numpy.testing import assert_, assert_equal, assert_allclose, assert_array_equal
from nose.tools import assert_greater, assert_less
import numpy
from sklearn.... | apache-2.0 |
imaculate/scikit-learn | benchmarks/bench_plot_omp_lars.py | 28 | 4471 | """Benchmarks of orthogonal matching pursuit (:ref:`OMP`) versus least angle
regression (:ref:`least_angle_regression`)
The input data is mostly low rank but is a fat infinite tail.
"""
from __future__ import print_function
import gc
import sys
from time import time
import numpy as np
from sklearn.linear_model impo... | bsd-3-clause |
bert9bert/statsmodels | statsmodels/examples/ex_scatter_ellipse.py | 39 | 1367 | '''example for grid of scatter plots with probability ellipses
Author: Josef Perktold
License: BSD-3
'''
from statsmodels.compat.python import lrange
import numpy as np
import matplotlib.pyplot as plt
from statsmodels.graphics.plot_grids import scatter_ellipse
nvars = 6
mmean = np.arange(1.,nvars+1)/nvars * 1.5
... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.