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 |
|---|---|---|---|---|---|
SWRG/ESWC2015-paper-evaluation | inject.py | 1 | 8791 | # -*- coding: utf-8 -*-
"""
This program reads in two N-Ttriples (.nt) files:
-the Host Dataset (HD)
-the Injection Dataset (ID)
and outputs the Connection Dataset (CD) as a N-Triples file.
The Connection Dataset contains ID to HD node connections that match the
average node degree of the HD. The concatenation... | gpl-3.0 |
NicovincX2/Python-3.5 | Analyse (mathématiques)/Analyse numérique/Équations différentielles numériques/Méthode des éléments finis/femmat2d.py | 1 | 6605 | # -*- coding: utf-8 -*-
"""
Class for generating 2D finite element matrices
Copyright (C) 2013 Greg von Winckel
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3... | gpl-3.0 |
fengzhyuan/scikit-learn | sklearn/metrics/tests/test_common.py | 83 | 41144 | from __future__ import division, print_function
from functools import partial
from itertools import product
import numpy as np
import scipy.sparse as sp
from sklearn.datasets import make_multilabel_classification
from sklearn.preprocessing import LabelBinarizer
from sklearn.utils.multiclass import type_of_target
fro... | bsd-3-clause |
francisco-dlp/hyperspy | hyperspy/drawing/_widgets/rectangles.py | 4 | 19797 | # -*- coding: utf-8 -*-
# Copyright 2007-2016 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 |
IntelLabs/hpat | docs/source/buildscripts/sdc_doc_utils.py | 1 | 14027 | # -*- coding: utf-8 -*-
# *****************************************************************************
# Copyright (c) 2020, Intel Corporation All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# ... | bsd-2-clause |
DiamondLightSource/auto_tomo_calibration-experimental | old_code_scripts/measure_resolution/lmfit-py/lmfit/ui/__init__.py | 7 | 1032 | # These variables are used at the end of the module to decide
# which BaseFitter subclass the Fitter will point to.
import warnings
has_ipython, has_matplotlib = False, False
try:
import matplotlib
except ImportError:
pass
else:
has_matplotlib = True
try:
import IPython
except ImportError:
pass
e... | apache-2.0 |
waynenilsen/statsmodels | statsmodels/datasets/spector/data.py | 25 | 2000 | """Spector and Mazzeo (1980) - Program Effectiveness Data"""
__docformat__ = 'restructuredtext'
COPYRIGHT = """Used with express permission of the original author, who
retains all rights. """
TITLE = __doc__
SOURCE = """
http://pages.stern.nyu.edu/~wgreene/Text/econometricanalysis.htm
The raw data was d... | bsd-3-clause |
sernst/cauldron | cauldron/test/cli/commands/test_open.py | 1 | 3656 | import os
from unittest.mock import MagicMock
from unittest.mock import patch
from cauldron import environ
from cauldron.test import support
from cauldron.test.support import scaffolds
MY_DIRECTORY = os.path.realpath(os.path.dirname(__file__))
class TestOpen(scaffolds.ResultsTest):
def test_list(self):
... | mit |
moutai/scikit-learn | sklearn/feature_extraction/tests/test_feature_hasher.py | 28 | 3652 | from __future__ import unicode_literals
import numpy as np
from sklearn.feature_extraction import FeatureHasher
from nose.tools import assert_raises, assert_true
from numpy.testing import assert_array_equal, assert_equal
def test_feature_hasher_dicts():
h = FeatureHasher(n_features=16)
assert_equal("dict",... | bsd-3-clause |
manojgudi/sandhi | modules/gr36/gr-utils/src/python/plot_psd_base.py | 75 | 12725 | #!/usr/bin/env python
#
# Copyright 2007,2008,2010,2011 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 ... | gpl-3.0 |
vortex-ape/scikit-learn | sklearn/decomposition/__init__.py | 21 | 1390 | """
The :mod:`sklearn.decomposition` module includes matrix decomposition
algorithms, including among others PCA, NMF or ICA. Most of the algorithms of
this module can be regarded as dimensionality reduction techniques.
"""
from .nmf import NMF, non_negative_factorization
from .pca import PCA
from .incremental_pca imp... | bsd-3-clause |
phobson/pygridtools | pygridtools/tests/test_validate.py | 2 | 5734 | import numpy
from matplotlib import pyplot
from shapely.geometry import Polygon, MultiPolygon
import geopandas
import pytest
import numpy.testing as nptest
from pygridtools import validate
from pygridgen.tests import raises
from . import utils
@pytest.fixture
def multipoly_gdf():
return geopandas.GeoDataFrame({... | bsd-3-clause |
moonbury/notebooks | github/MasteringMLWithScikit-learn/8365OS_08_Codes/ch-perceptron.py | 3 | 6280 | ################# Figure 1: Scatter plot of data #################
"""
"""
import numpy as np
import matplotlib.pyplot as plt
X = np.array([
[0.2, 0.1],
[0.4, 0.6],
[0.5, 0.2],
[0.7, 0.9]
])
y = [0, 0, 0, 1]
markers = ['.', 'x']
plt.scatter(X[:3, 0], X[:3, 1], marker='.', s=400)
plt.scatter(X[3, 0], ... | gpl-3.0 |
Aryan-Barbarian/bigbang | bigbang/repo_loader.py | 3 | 7776 | from git_repo import GitRepo, MultiGitRepo
import json;
import os;
import re;
import subprocess;
import sys;
import pandas as pd
import requests
import fnmatch
from IPython.nbformat import current as nbformat
from IPython.nbconvert import PythonExporter
import networkx as nx
import compiler
from compiler.ast import Fro... | gpl-2.0 |
midusi/handshape_recognition | tutorial/tfenv/share/doc/networkx-1.11/examples/drawing/giant_component.py | 15 | 2287 | #!/usr/bin/env python
"""
This example illustrates the sudden appearance of a
giant connected component in a binomial random graph.
Requires pygraphviz and matplotlib to draw.
"""
# Copyright (C) 2006-2016
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <swart@lanl.gov>... | agpl-3.0 |
michigraber/scikit-learn | examples/exercises/plot_iris_exercise.py | 323 | 1602 | """
================================
SVM Exercise
================================
A tutorial exercise for using different SVM kernels.
This exercise is used in the :ref:`using_kernels_tut` part of the
:ref:`supervised_learning_tut` section of the :ref:`stat_learn_tut_index`.
"""
print(__doc__)
import numpy as np
i... | bsd-3-clause |
ye-zhi/project-epsilon | code/utils/scripts/noise-pca_script.py | 1 | 13894 | """
This script is used to design the design matrix for our linear regression.
We explore the influence of linear and quadratic drifts on the model
performance.
Script for the raw data.
Run with:
python noise-pca_script.py
from this directory
"""
from __future__ import print_function, division
import sys, os,... | bsd-3-clause |
srnas/barnaba | test/plot_karplus.py | 1 | 5466 | from __future__ import absolute_import, division, print_function
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
cp = sns.color_palette(n_colors=9)
sns.set_style("white")
sns.set_context("paper")
# sugar
def sugar_hasnoot_h1h2(x):
v = [6.96462,-0.91,1.02629,1.27009,0]
cos = np.cos(x+v... | gpl-3.0 |
anurag313/scikit-learn | sklearn/preprocessing/label.py | 137 | 27165 | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Mathieu Blondel <mathieu@mblondel.org>
# Olivier Grisel <olivier.grisel@ensta.org>
# Andreas Mueller <amueller@ais.uni-bonn.de>
# Joel Nothman <joel.nothman@gmail.com>
# Hamzeh Alsalhi <ha258@cornell.edu>
# Licens... | bsd-3-clause |
madjelan/scikit-learn | sklearn/datasets/tests/test_20news.py | 280 | 3045 | """Test the 20news downloader, if the data is available."""
import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import SkipTest
from sklearn import datasets
def test_20news():
try:
data = dat... | bsd-3-clause |
jakevdp/scipy | scipy/interpolate/tests/test_rbf.py | 14 | 4604 | # Created by John Travers, Robert Hetland, 2007
""" Test functions for rbf module """
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.testing import (assert_, assert_array_almost_equal,
assert_almost_equal, run_module_suite)
from numpy import l... | bsd-3-clause |
weixuanfu/tpot | tpot/gp_deap.py | 1 | 20477 | # -*- coding: utf-8 -*-
"""This file is part of the TPOT library.
TPOT was primarily developed at the University of Pennsylvania by:
- Randal S. Olson (rso@randalolson.com)
- Weixuan Fu (weixuanf@upenn.edu)
- Daniel Angell (dpa34@drexel.edu)
- and many more generous open source contributors
TPOT is f... | lgpl-3.0 |
hammerlab/mhcflurry | test/test_class1_processing_predictor.py | 1 | 2029 | 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 mhcflurr... | apache-2.0 |
sourabhdattawad/BuildingMachineLearningSystemsWithPython | ch04/build_lda.py | 22 | 2443 | # This code is supporting material for the book
# Building Machine Learning Systems with Python
# by Willi Richert and Luis Pedro Coelho
# published by PACKT Publishing
#
# It is made available under the MIT License
from __future__ import print_function
try:
import nltk.corpus
except ImportError:
print("nltk n... | mit |
RichardWarfield/cgt | thirdparty/tabulate.py | 24 | 29021 | # -*- coding: utf-8 -*-
"""Pretty-print tabular data."""
from __future__ import print_function
from __future__ import unicode_literals
from collections import namedtuple
from platform import python_version_tuple
import re
if python_version_tuple()[0] < "3":
from itertools import izip_longest
from functools ... | mit |
zihua/scikit-learn | examples/applications/plot_stock_market.py | 76 | 8522 | """
=======================================
Visualizing the stock market structure
=======================================
This example employs several unsupervised learning techniques to extract
the stock market structure from variations in historical quotes.
The quantity that we use is the daily variation in quote ... | bsd-3-clause |
josh-willis/pycbc | bin/hdfcoinc/pycbc_plot_Nth_loudest_coinc_omicron.py | 10 | 6303 | """
Generates a plot that shows the time-frequency trace of
Nth loudest coincident trigger overlaid on a background of
Omicron triggers.
"""
import logging
import h5py
import numpy as np
import argparse
import glob
from glue.ligolw import ligolw, lsctables, table, utils
import matplotlib
matplotlib.use('Agg')
import m... | gpl-3.0 |
tomsilver/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/backends/backend_qtagg.py | 73 | 4972 | """
Render to qt from agg
"""
from __future__ import division
import os, sys
import matplotlib
from matplotlib import verbose
from matplotlib.figure import Figure
from backend_agg import FigureCanvasAgg
from backend_qt import qt, FigureManagerQT, FigureCanvasQT,\
show, draw_if_interactive, backend_version, \
... | gpl-3.0 |
Gregor-Mendel-Institute/AraGeno | arageno/plotting.py | 1 | 1702 | import json
import numpy as np
import pandas as pd
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
import seaborn as sns
from .models import CrossesJob, FINISHED
sns.set(style="whitegrid", color_codes=True)
def _get_chromosome_ticks(chromosome_regions,windows):
sorted_chr = sorted(chromos... | mit |
mxlei01/healthcareai-py | setup.py | 4 | 2465 | # -*- coding: utf-8 -*-
# from __future__ import unicode_literals
from setuptools import setup, find_packages
def readme():
# I really prefer Markdown to reStructuredText. PyPi does not. This allows me
# to have things how I'd like, but not throw complaints when people are trying
# to install the packag... | mit |
vshtanko/scikit-learn | sklearn/cluster/tests/test_spectral.py | 262 | 7954 | """Testing for Spectral Clustering methods"""
from sklearn.externals.six.moves import cPickle
dumps, loads = cPickle.dumps, cPickle.loads
import numpy as np
from scipy import sparse
from sklearn.utils import check_random_state
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_a... | bsd-3-clause |
Barmaley-exe/scikit-learn | benchmarks/bench_plot_parallel_pairwise.py | 297 | 1247 | # Author: Mathieu Blondel <mathieu@mblondel.org>
# License: BSD 3 clause
import time
import pylab as pl
from sklearn.utils import check_random_state
from sklearn.metrics.pairwise import pairwise_distances
from sklearn.metrics.pairwise import pairwise_kernels
def plot(func):
random_state = check_random_state(0)
... | bsd-3-clause |
mac389/computational-medical-knowledge | src/analyze.py | 2 | 1910 | # -*- coding: utf-8 -*-
"""
python analyze.py --pipeline "method1 method2" --input "file1 file2"
"""
import optparse
import itertools
import os
import matplotlib
matplotlib.use('Agg')
import seaborn as sns
import matplotlib.pyplot as plt
import utils as tech
import numpy as np
from sys import argv
from os.path... | apache-2.0 |
ChristosChristofidis/bokeh | examples/compat/mpl/listcollection.py | 13 | 1573 | import numpy as np
import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection
from bokeh import mpl
from bokeh.plotting import show
def make_segments(x, y):
'''
Create list of line segments from x and y coordinates.
'''
points = np.array([x, y]).T.reshape(-1, 1, 2)
segments... | bsd-3-clause |
youprofit/scikit-image | doc/examples/plot_log_gamma.py | 3 | 2035 | """
=================================
Gamma and log contrast adjustment
=================================
This example adjusts image contrast by performing a Gamma and a Logarithmic
correction on the input image.
"""
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
from skimage import data, img_a... | bsd-3-clause |
nesterione/scikit-learn | sklearn/svm/classes.py | 126 | 40114 | import warnings
import numpy as np
from .base import _fit_liblinear, BaseSVC, BaseLibSVM
from ..base import BaseEstimator, RegressorMixin
from ..linear_model.base import LinearClassifierMixin, SparseCoefMixin, \
LinearModel
from ..feature_selection.from_model import _LearntSelectorMixin
from ..utils import check_X... | bsd-3-clause |
michigraber/scikit-learn | sklearn/decomposition/pca.py | 192 | 23117 | """ Principal Component Analysis
"""
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Olivier Grisel <olivier.grisel@ensta.org>
# Mathieu Blondel <mathieu@mblondel.org>
# Denis A. Engemann <d.engemann@fz-juelich.de>
# Michael Eickenberg <michael.eickenberg@inria.fr>
#
# Lice... | bsd-3-clause |
pandeydivesh15/AI_lab-codes | HMM_Viterbi/hmm_model.py | 1 | 2939 | import numpy as np
import pandas as pd
class Hmm_model(object):
def __init__(self, file_loc):
self.train_data_file = file_loc
def measure_probabilites(self):
self.state_trans_prob = pd.DataFrame(
data = 0,
index = self.tags,
columns = self.tags)
self.emission_prob = pd.DataFrame(
... | mit |
DLunin/bayescraft | graphmodels/factors.py | 1 | 17098 | import numpy.random as rand
from numpy import log, exp
import itertools
from itertools import product
import pandas as pd
from .utility import pretty_print_distr_dict, pretty_print_distr_table, pretty_draw, lmap, plot_distr
from .distributions import *
class Factor:
def __call__(self, *args, kwargs):
retu... | mit |
rl-institut/reegis_hp | reegis_hp/de21/powerplants.py | 3 | 32039 | """
Getting the renewable power plants of Germany.
To use this script you have to download the
renewable_power_plants_DE.info.csv file and copy it to the data folder.
Get information about the used csv-file.
csv = pd.read_csv(
os.path.join('data_original', 'renewable_power_plants_DE.info.csv'),
squeeze=True, ... | gpl-3.0 |
vgmartinez/incubator-zeppelin | interpreter/lib/python/mpl_config.py | 9 | 3286 | # 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 use ... | apache-2.0 |
RegulatoryGenomicsUPF/pyicoteo | pyicoteolib/turbomix.py | 1 | 54953 | """
Pyicoteo is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY... | gpl-3.0 |
conversationai/wikidetox | experimental/conversation_go_awry/feature_extraction/user_features/get_metadata_features.py | 1 | 2681 | """
Copyright 2017 Google 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, software
dis... | apache-2.0 |
ymollard/APEX | scripts/analysis/analyze_ergo_ball.py | 3 | 1902 | import os
import sys
import cPickle
import numpy as np
import matplotlib.pyplot as plt
# PARAMS
filename = "/home/sforesti/ros/home/ros/Repos/NIPS2016/ros/nips2016/logs/experiment.pickle"
filename = "/home/sforesti/ros/home/ros/Repos/NIPS2016/ros/nips2016/logs/experiment_FGB_4.pickle"
with open(filename, 'r') as f:
... | gpl-3.0 |
grimoirelab/perceval | tests/test_stackexchange.py | 1 | 18764 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2019 Bitergia
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any l... | gpl-3.0 |
boomsbloom/dtm-fmri | DTM/for_gensim/lib/python2.7/site-packages/sklearn/tests/test_isotonic.py | 34 | 14159 | import warnings
import numpy as np
import pickle
import copy
from sklearn.isotonic import (check_increasing, isotonic_regression,
IsotonicRegression)
from sklearn.utils.testing import (assert_raises, assert_array_equal,
assert_true, assert_false, assert... | mit |
asoliveira/NumShip | scripts/plot/r-velo-u-zz-plt.py | 1 | 3013 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#É adimensional?
adi = False
#É para salvar as figuras(True|False)?
save = True
#Caso seja para salvar, qual é o formato desejado?
formato = 'jpg'
#Caso seja para salvar, qual é o diretório que devo salvar?
dircg = 'fig-sen'
#Caso seja para salvar, qual é o nome do arquivo... | gpl-3.0 |
marcocaccin/scikit-learn | benchmarks/bench_plot_ward.py | 290 | 1260 | """
Benchmark scikit-learn's Ward implement compared to SciPy's
"""
import time
import numpy as np
from scipy.cluster import hierarchy
import pylab as pl
from sklearn.cluster import AgglomerativeClustering
ward = AgglomerativeClustering(n_clusters=3, linkage='ward')
n_samples = np.logspace(.5, 3, 9)
n_features = n... | bsd-3-clause |
lthurlow/Network-Grapher | proj/external/matplotlib-1.2.1/build/lib.linux-i686-2.7/matplotlib/lines.py | 2 | 39103 | """
This module contains all the 2D line class which can draw with a
variety of line styles, markers and colors.
"""
# TODO: expose cap and join style attrs
from __future__ import division, print_function
import warnings
import numpy as np
from numpy import ma
from matplotlib import verbose
import artist
from artist... | mit |
chen0510566/MissionPlanner | Lib/site-packages/scipy/signal/fir_filter_design.py | 53 | 18572 | """Functions for FIR filter design."""
from math import ceil, log
import numpy as np
from numpy.fft import irfft
from scipy.special import sinc
import sigtools
# Some notes on function parameters:
#
# `cutoff` and `width` are given as a numbers between 0 and 1. These
# are relative frequencies, expressed as a fracti... | gpl-3.0 |
suraj-jayakumar/lstm-rnn-ad | src/inet/LSTM.py | 1 | 2321 | import numpy as np
import matplotlib.pyplot as plt
from keras.models import Sequential
from keras.layers.core import Dense
from keras.layers.recurrent import LSTM
from keras.layers.core import Dropout
from keras.models import Graph
from keras.models import model_from_json
import pickle
#CONSTANTS
tsteps = 24
bat... | apache-2.0 |
anirudhjayaraman/scikit-learn | sklearn/metrics/regression.py | 175 | 16953 | """Metrics to assess performance on regression task
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.gramfort@inria.fr>
# Ma... | bsd-3-clause |
cosmicBboy/themis-ml | tests/test_reject_option_classification.py | 1 | 4843 | """Unit tests for reject option classification."""
import math
import numpy as np
import pytest
from sklearn.exceptions import NotFittedError
from themis_ml.postprocessing.reject_option_classification import (
SingleROClassifier, MultipleROClassifier, DECISION_THRESHOLD)
from conftest import create_linear_X, cre... | mit |
florentchandelier/zipline | zipline/finance/risk/cumulative.py | 3 | 12424 | #
# 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 |
Barmaley-exe/scikit-learn | sklearn/cluster/tests/test_spectral.py | 11 | 7958 | """Testing for Spectral Clustering methods"""
from sklearn.externals.six.moves import cPickle
dumps, loads = cPickle.dumps, cPickle.loads
import numpy as np
from scipy import sparse
from sklearn.utils import check_random_state
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_a... | bsd-3-clause |
zingale/pyreaclib | templates/sundials-cvode/plot_weak_table.py | 2 | 1856 | """
This program plots the emission and capture tables produced
by the program output_table.f90 akin to the plots in Toki, et al 2013.
Donald Willcox
"""
import numpy as np
import argparse
import matplotlib.pyplot as plt
parser = argparse.ArgumentParser()
parser.add_argument('--emission_infile',type=str, help='The ... | bsd-3-clause |
RockRaidersInc/ROS-Main | vision/neural_nets/p1_train_svm.py | 1 | 6990 | import numpy as np
from sklearn.svm import LinearSVC
from sklearn.exceptions import ConvergenceWarning
from functools import reduce
import warnings
from confusion_mat_tools import save_confusion_matrix
def read_dataset(filename):
# The dataset features are stored in a .npz file, np.load will give us a dictionary... | gpl-3.0 |
tardis-sn/tardis | tardis/plasma/properties/level_population.py | 1 | 3124 | import logging
import pandas as pd
import numpy as np
from tardis.plasma.properties.base import ProcessingPlasmaProperty
logger = logging.getLogger(__name__)
__all__ = ["LevelNumberDensity", "LevelNumberDensityHeNLTE"]
class LevelNumberDensity(ProcessingPlasmaProperty):
"""
Calculates the level populations... | bsd-3-clause |
abele/bokeh | bokeh/protocol.py | 37 | 3282 | from __future__ import absolute_import
import json
import logging
import datetime as dt
import calendar
import decimal
from .util.serialization import transform_series, transform_array
import numpy as np
try:
import pandas as pd
is_pandas = True
except ImportError:
is_pandas = False
try:
from dateut... | bsd-3-clause |
ua-snap/downscale | snap_scripts/old_scripts/tem_iem_older_scripts_april2018/tem_inputs_iem/old_code/cru_cl20_1961_1990_climatology_preprocess.py | 1 | 12511 | import numpy as np # hack to solve a lib issue in the function args of xyztogrid
def cru_xyz_to_shp( in_xyz, lon_col, lat_col, crs, output_filename ):
'''
convert the cru cl2.0 1961-1990 Climatology data to a shapefile.
*can handle the .dat format even if compressed with .gzip extension.
PARAMETERS:
-----------
... | mit |
matthijsvk/multimodalSR | code/audioSR/Experiments/recnet/examples/little_timer_task/train_model.py | 2 | 4050 | #!/usr/bin/env python
""" Little timer task """
"""___________________"""
""" TRAIN MODEL
"""
###### Set global Theano config #######
import os
t_flags = "mode=FAST_RUN,device=cpu,floatX=float32, optimizer='fast_run', allow_gc=False"
print("Theano Flags: " + t_flags)
os.environ["THEANO_FLAGS"] = t_flags
#####... | mit |
enlighter/learnML | learn/numpyNpandas/pandas-play_series.py | 3 | 1924 | import pandas as pd
'''
The following code is to help you play with the concept of Series in Pandas.
You can think of Series as an one-dimensional object that is similar to
an array, list, or column in a database. By default, it will assign an
index label to each item in the Series ranging from 0 to N, where N is
the... | mit |
xyguo/scikit-learn | examples/ensemble/plot_adaboost_hastie_10_2.py | 355 | 3576 | """
=============================
Discrete versus Real AdaBoost
=============================
This example is based on Figure 10.2 from Hastie et al 2009 [1] and illustrates
the difference in performance between the discrete SAMME [2] boosting
algorithm and real SAMME.R boosting algorithm. Both algorithms are evaluate... | bsd-3-clause |
JavierGarciaD/athena | athena/utils/helpers.py | 1 | 2551 | """
different helpers
"""
import pandas as pd
import numpy as np
import os
def make_fake_csv(filename, start_date, end_date,
style=None, save_to=None):
"""
Function creates csv files for testing, with columns as expected
for CSV data handler.
Files are saved in temp di... | gpl-3.0 |
DonBeo/scikit-learn | examples/linear_model/plot_ols_3d.py | 350 | 2040 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Sparsity Example: Fitting only features 1 and 2
=========================================================
Features 1 and 2 of the diabetes-dataset are fitted and
plotted below. It illustrates that although feature... | bsd-3-clause |
robin-lai/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 |
stylianos-kampakis/scikit-learn | examples/gaussian_process/plot_gp_regression.py | 253 | 4054 | #!/usr/bin/python
# -*- coding: utf-8 -*-
r"""
=========================================================
Gaussian Processes regression: basic introductory example
=========================================================
A simple one-dimensional regression exercise computed in two different ways:
1. A noise-free cas... | bsd-3-clause |
openstreams/SGR | sgr/sgr_data.py | 1 | 12366 | import numpy as np
import modis_waterfrac
import netCDF4
import sgr
import sgr.utils
import pandas
def signaltoq_pandas(signalframe,qnetcdf, signalnetcdf):
"""
Retrieves Q estimates for all points in the pandas dataframe
Column header are interpreted as station id's
:param signal dataframe:
:re... | gpl-3.0 |
sasdelli/lc_predictor | lc_predictor/savgol.py | 1 | 3104 | import numpy as np
# This is Thomas Haslwanter's implementation at:
# http://wiki.scipy.org/Cookbook/SavitzkyGolay
def savitzky_golay(y, window_size, order, deriv=0):
r"""Smooth (and optionally differentiate) data with a Savitzky-Golay filter.
The Savitzky-Golay filter removes high frequency noise from data.
... | gpl-3.0 |
gijs/solpy | solpy/nsrdb.py | 2 | 5029 | # Copyright (C) 2012 Nathan Charles
#
# This program is free software. See terms in LICENSE file.
"""look at NSRDB historical data"""
import csv
import datetime
import os
import numpy as np
from solpy import tools
#path to data defaults to cwd unless NCDCDATA enviromental variable is set
CWD = os.getcwd()
PATH = [os.g... | lgpl-2.1 |
IvarsKarpics/mxcube | gui/widgets/matplot_widget.py | 1 | 20122 | # pylint: skip-file
# Project: MXCuBE
# https://github.com/mxcube
#
# This file is part of MXCuBE software.
#
# MXCuBE is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the Lice... | lgpl-3.0 |
pompiduskus/scikit-learn | sklearn/cluster/mean_shift_.py | 106 | 14056 | """Mean shift clustering algorithm.
Mean shift clustering aims to discover *blobs* in a smooth density of
samples. It is a centroid based algorithm, which works by updating candidates
for centroids to be the mean of the points within a given region. These
candidates are then filtered in a post-processing stage to elim... | bsd-3-clause |
mthh/python-osrm | osrm/extra.py | 1 | 9266 | # -*- coding: utf-8 -*-
"""
@author: mthh
"""
from .core import table
from . import RequestConfig, Point as _Point
import numpy as np
from shapely.geometry import MultiPolygon, Polygon, Point
from geopandas import GeoDataFrame, pd
import matplotlib
if not matplotlib.get_backend():
matplotlib.use('Agg')
import matpl... | mit |
pompiduskus/scikit-learn | examples/decomposition/plot_pca_vs_lda.py | 182 | 1743 | """
=======================================================
Comparison of LDA and PCA 2D projection of Iris dataset
=======================================================
The Iris dataset represents 3 kind of Iris flowers (Setosa, Versicolour
and Virginica) with 4 attributes: sepal length, sepal width, petal length
a... | bsd-3-clause |
wheeler-microfluidics/dmf_control_board | dmf_control_board_firmware/gui/impedance.py | 3 | 15976 | #!/usr/bin/env python
import pkg_resources
import numpy as np
import pandas as pd
import gtk
from pygtkhelpers.delegates import WindowView
from pygtkhelpers.ui.form_view_dialog import create_form_view
from flatland.schema import Form, Integer
from flatland.validation import ValueAtLeast, ValueAtMost
from IPython.displ... | gpl-3.0 |
l2xBrain/chineseocr | imagedevide.py | 1 | 7621 | # coding:utf8
import sys
import cv2
# import cv2.cv as cv
import numpy as np
from PIL import Image
import os
import time
import helper
import matplotlib.pyplot as plot
import correctimage
def preprocess(gray, filename='', image_root_path=''):
# 1. Sobel算子,x方向求梯度
sobel = cv2.Sobel(gray, cv2.CV_8U, 1, 0, ksize=1)
... | mit |
telefar/stockEye | coursera-compinvest1-master/coursera-compinvest1-master/homework/homework/homework7/hw7_analyse.py | 1 | 1937 | ## Computational Investing I
## HW 7 - analyse.py
##
## Author: alexcpsec
import pandas as pd
import pandas.io.parsers as pd_par
import numpy as np
import math
import copy
import QSTK.qstkutil.qsdateutil as du
import datetime as dt
import QSTK.qstkutil.DataAccess as da
import QSTK.qstkutil.tsutil as tsu
NUM_TRADING_D... | bsd-3-clause |
appapantula/scikit-learn | examples/linear_model/plot_sgd_penalties.py | 249 | 1563 | """
==============
SGD: Penalties
==============
Plot the contours of the three penalties.
All of the above are supported by
:class:`sklearn.linear_model.stochastic_gradient`.
"""
from __future__ import division
print(__doc__)
import numpy as np
import matplotlib.pyplot as plt
def l1(xs):
return np.array([np.... | bsd-3-clause |
pmlrsg/arsf_tools | plot_info_from_headers.py | 1 | 12578 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Gets information from multiple ENVI header files and plots them or saves
to a file. Also has the option to save all values to a csv file. Assumes that if
there are 2 detectors, one is VNIR and the second is SWIR. Can be used on
raw, level 1 or level 3 headers. Applicati... | gpl-3.0 |
Junji110/elephant | elephant/asset.py | 1 | 69275 | """
ASSET is a statistical method [1] for the detection of repeating sequences
of synchronous spiking events in parallel spike trains.
Given a list `sts` of spike trains, the analysis comprises the following
steps:
1) Build the intersection matrix `imat` (optional) and the associated
probability matrix `pmat` with ... | bsd-3-clause |
soulmachine/scikit-learn | sklearn/preprocessing/label.py | 2 | 27984 | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Mathieu Blondel <mathieu@mblondel.org>
# Olivier Grisel <olivier.grisel@ensta.org>
# Andreas Mueller <amueller@ais.uni-bonn.de>
# Joel Nothman <joel.nothman@gmail.com>
# Hamzeh Alsalhi <ha258@cornell.edu>
# Licens... | bsd-3-clause |
TomAugspurger/pandas | pandas/tests/indexes/multi/test_sorting.py | 2 | 8406 | import random
import numpy as np
import pytest
from pandas.errors import PerformanceWarning, UnsortedIndexError
import pandas as pd
from pandas import CategoricalIndex, DataFrame, Index, MultiIndex, RangeIndex
import pandas._testing as tm
def test_sortlevel(idx):
tuples = list(idx)
random.shuffle(tuples)
... | bsd-3-clause |
Darthone/bug-free-octo-parakeet | web/backend/app.py | 2 | 4687 | #!/usr/bin/env python
"""
Backend rest server for IFC
How to use:
- source the top level virtual environment and run
"""
import ujson as json
import pandas as pd
import random # for spoofing
from datetime import datetime
from flask import Flask
from flask_restful import reqparse, abort, Api, Resource... | mit |
huanzhang12/LightGBM | python-package/lightgbm/engine.py | 1 | 18760 | # coding: utf-8
# pylint: disable = invalid-name, W0105
"""Training Library containing training routines of LightGBM."""
from __future__ import absolute_import
import collections
from operator import attrgetter
import numpy as np
from . import callback
from .basic import Booster, Dataset, LightGBMError, _InnerPredic... | mit |
toros-astro/ProperImage | drafts/test_recover_stats.py | 1 | 3625 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# test_recoverstats.py
#
# Copyright 2016 Bruno S <bruno.sanchez.63@gmail.com>
#
import os
import shlex
import subprocess
import sys
sys.path.insert(0, os.path.abspath('..'))
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import stats
import sep
... | bsd-3-clause |
gwaygenomics/tad_pathways | scripts/assign_evidence_to_TADs.py | 1 | 3669 | """
2016 Gregory Way
scripts/assign_evidence_to_TADs.py
Description:
Takes in genes and evidence support and assigns each gene to the TAD
Usage:
Command line:
python scripts/assign_evidence_to_TADs.py
With the following flags:
--evidence The location of the evidence file
--spns T... | bsd-3-clause |
BiaDarkia/scikit-learn | sklearn/tests/test_kernel_ridge.py | 46 | 3043 | import numpy as np
import scipy.sparse as sp
from sklearn.datasets import make_regression
from sklearn.linear_model import Ridge
from sklearn.kernel_ridge import KernelRidge
from sklearn.metrics.pairwise import pairwise_kernels
from sklearn.utils.testing import ignore_warnings
from sklearn.utils.testing import assert... | bsd-3-clause |
EttusResearch/gnuradio | gr-digital/examples/berawgn.py | 17 | 4897 | #!/usr/bin/env python
#
# Copyright 2012,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your optio... | gpl-3.0 |
decvalts/landlab | landlab/components/potentiality_flowrouting/examples/test_script_fr.py | 1 | 5529 | # -*- coding: utf-8 -*-
"""
A script of VV's potentiality flow routing method.
Created on Fri Feb 20 13:45:52 2015
@author: danhobley
"""
from __future__ import print_function
#from landlab import RasterModelGrid
#from landlab.plot.imshow import imshow_node_grid
import numpy as np
from pylab import imshow, show, con... | mit |
sarahgrogan/scikit-learn | sklearn/ensemble/voting_classifier.py | 178 | 8006 | """
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>
#
# Licence: BSD 3 clause
import numpy as np
from ..base import BaseEstimator
f... | bsd-3-clause |
cpcloud/ibis | ibis/pandas/execution/temporal.py | 1 | 9387 | import datetime
import numpy as np
import pandas as pd
from pandas.core.groupby import SeriesGroupBy
import ibis
import ibis.expr.datatypes as dt
import ibis.expr.operations as ops
from ibis.pandas.core import (
date_types,
integer_types,
numeric_types,
timedelta_types,
timestamp_types,
)
from ibi... | apache-2.0 |
idiosyncraticee/chalearn | src/skeleton.py | 1 | 3649 | # PARSER FOR ANALYZING KAGGLE/CHALEARN ROUND 3 DATA
# THIS IS STILL QUITE INCOMPLETE
import scipy.io
import numpy
import sklearn
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import nd_dtw
numpy.set_printoptions(threshold='nan')
def load_challenge_data():
#TURN ON PLOTTING
plot=1
#... | mit |
Orpine/py-R-FCN | tools/demo.py | 10 | 5028 | #!/usr/bin/env python
# --------------------------------------------------------
# Faster R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""
Demo script showing detections in sample i... | mit |
fzalkow/scikit-learn | benchmarks/bench_mnist.py | 154 | 6006 | """
=======================
MNIST dataset benchmark
=======================
Benchmark on the MNIST dataset. The dataset comprises 70,000 samples
and 784 features. Here, we consider the task of predicting
10 classes - digits from 0 to 9 from their raw images. By contrast to the
covertype dataset, the feature space is... | bsd-3-clause |
fumitoh/modelx | modelx/serialize/pandas_compat.py | 1 | 1147 | import pickle
import copy
from .custom_pickle import ModelUnpickler
from pandas.compat import pickle_compat as pc
# Since pickle._Unpickler is written in pure Python and
# pickle.Unpickler is written in C,
# CompatUnpickler is slower then ModelUnpickler, so
# Use CompatUpickler only when needed.
class CompatUnpickle... | gpl-3.0 |
ZENGXH/scikit-learn | examples/preprocessing/plot_robust_scaling.py | 221 | 2702 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Robust Scaling on Toy Data
=========================================================
Making sure that each Feature has approximately the same scale can be a
crucial preprocessing step. However, when data contains o... | bsd-3-clause |
kenshay/ImageScripter | ProgramData/SystemFiles/Python/share/doc/networkx-2.2/examples/subclass/plot_antigraph.py | 5 | 6064 | """
=========
Antigraph
=========
Complement graph class for small footprint when working on dense graphs.
This class allows you to add the edges that *do not exist* in the dense
graph. However, when applying algorithms to this complement graph data
structure, it behaves as if it were the dense version. So it can be ... | gpl-3.0 |
vybstat/scikit-learn | sklearn/tests/test_naive_bayes.py | 70 | 17509 | import pickle
from io import BytesIO
import numpy as np
import scipy.sparse
from sklearn.datasets import load_digits, load_iris
from sklearn.cross_validation import cross_val_score, train_test_split
from sklearn.externals.six.moves import zip
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.te... | bsd-3-clause |
aestrivex/mne-python | examples/datasets/plot_spm_faces_dataset.py | 17 | 4379 | # doc:slow-example
"""
==========================================
From raw data to dSPM on SPM Faces dataset
==========================================
Runs a full pipeline using MNE-Python:
- artifact removal
- averaging Epochs
- forward model computation
- source reconstruction using dSPM on the contrast : "faces - ... | bsd-3-clause |
bikong2/scikit-learn | examples/model_selection/randomized_search.py | 201 | 3214 | """
=========================================================================
Comparing randomized search and grid search for hyperparameter estimation
=========================================================================
Compare randomized search and grid search for optimizing hyperparameters of a
random forest.
... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.