repo_name
stringlengths
6
96
path
stringlengths
4
191
copies
stringclasses
322 values
size
stringlengths
4
6
content
stringlengths
762
753k
license
stringclasses
15 values
pascalgutjahr/Praktikum-1
Schwingung/phaselinear.py
1
1829
import numpy as np import uncertainties.unumpy as unp from uncertainties.unumpy import (nominal_values as noms, std_devs as stds) import matplotlib.pyplot as plt import matplotlib as mpl from scipy.optimize import curve_fit plt.rcParams['figure.figsize'] = (12, 8) plt.rcParams['font.size'] = 13 plt.rcParams['lines.line...
mit
kenshay/ImageScripter
ProgramData/SystemFiles/Python/Lib/site-packages/pandas/tseries/tdi.py
7
32620
""" implement the TimedeltaIndex """ from datetime import timedelta import numpy as np from pandas.types.common import (_TD_DTYPE, is_integer, is_float, is_bool_dtype, is_list_like, is_sc...
gpl-3.0
vinhqdang/my_mooc
coursera/advanced_machine_learning_spec/4_nlp/natural-language-processing-master/project/dialogue_manager.py
1
3010
import os from sklearn.metrics.pairwise import pairwise_distances_argmin from chatterbot import ChatBot from utils import * class ThreadRanker(object): def __init__(self, paths): self.word_embeddings, self.embeddings_dim = load_embeddings(paths['WORD_EMBEDDINGS']) self.thread_embeddings_folder = ...
mit
czhengsci/veidt
veidt/metrics.py
1
1250
from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import six from sklearn.metrics import mean_squared_error, mean_absolute_error from veidt.utils.general_utils import deserialize_veidt_object from veidt.utils.general_utils import serialize_...
bsd-3-clause
pepper-johnson/Erudition
Thesis/Processing/Pipeline/reddit_slim_comments.py
1
1815
import json import datetime import pandas as pd # *********** # Methods: # *********** def get_config(config_file): assert type(config_file) == str with open(config_file) as f: config = json.load(f) return config # ******** # Main: # - purpose: take all reddit comment files that were produc...
apache-2.0
henrykironde/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
Myasuka/scikit-learn
sklearn/feature_extraction/tests/test_dict_vectorizer.py
276
3790
# Authors: Lars Buitinck <L.J.Buitinck@uva.nl> # Dan Blanchard <dblanchard@ets.org> # License: BSD 3 clause from random import Random import numpy as np import scipy.sparse as sp from numpy.testing import assert_array_equal from sklearn.utils.testing import (assert_equal, assert_in, ...
bsd-3-clause
yavalvas/yav_com
build/matplotlib/doc/mpl_examples/pylab_examples/fill_between_demo.py
6
2116
#!/usr/bin/env python import matplotlib.pyplot as plt import numpy as np x = np.arange(0.0, 2, 0.01) y1 = np.sin(2*np.pi*x) y2 = 1.2*np.sin(4*np.pi*x) fig, (ax1, ax2, ax3) = plt.subplots(3,1, sharex=True) ax1.fill_between(x, 0, y1) ax1.set_ylabel('between y1 and 0') ax2.fill_between(x, y1, 1) ax2.set_ylabel('betwee...
mit
equialgo/scikit-learn
examples/ensemble/plot_adaboost_multiclass.py
354
4124
""" ===================================== Multi-class AdaBoosted Decision Trees ===================================== This example reproduces Figure 1 of Zhu et al [1] and shows how boosting can improve prediction accuracy on a multi-class problem. The classification dataset is constructed by taking a ten-dimensional ...
bsd-3-clause
jjx02230808/project0223
examples/manifold/plot_mds.py
45
2731
""" ========================= Multi-dimensional scaling ========================= An illustration of the metric and non-metric MDS on generated noisy data. The reconstructed points using the metric MDS and non metric MDS are slightly shifted to avoid overlapping. """ # Author: Nelle Varoquaux <nelle.varoquaux@gmail....
bsd-3-clause
muneebalam/scrapenhl2
scrapenhl2/scrape/schedules.py
1
15634
""" This module contains methods related to season schedules. """ import arrow import datetime import functools import json import os.path import urllib.request import feather import pandas as pd import scrapenhl2.scrape.general_helpers as helpers import scrapenhl2.scrape.organization as organization import scrapenh...
mit
Odingod/mne-python
mne/io/fiff/tests/test_raw.py
1
38869
from __future__ import print_function # Author: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Denis Engemann <denis.engemann@gmail.com> # # License: BSD (3-clause) import os import os.path as op import glob from copy import deepcopy import warnings import itertools as itt import numpy as np ...
bsd-3-clause
HolgerPeters/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
apdavison/elephant
elephant/current_source_density_src/icsd.py
9
35175
# -*- coding: utf-8 -*- ''' py-iCSD toolbox! Translation of the core functionality of the CSDplotter MATLAB package to python. The methods were originally developed by Klas H. Pettersen, as described in: Klas H. Pettersen, Anna Devor, Istvan Ulbert, Anders M. Dale, Gaute T. Einevoll, Current-source density estimation ...
bsd-3-clause
lthurlow/Network-Grapher
proj/external/matplotlib-1.2.1/doc/make.py
1
7453
#!/usr/bin/env python from __future__ import print_function import fileinput import glob import os import shutil import sys ### Begin compatibility block for pre-v2.6: ### # # ignore_patterns and copytree funtions are copies of what is included # in shutil.copytree of python v2.6 and later. # ### When compatibility i...
mit
jasonleaster/Machine_Learning
SAMME/tester.py
1
1351
""" Programmer : EOF Date : 2015.11.22 File : tester.py File Description: This file is used to test the adaboost which is a classical automatic classifier. """ import numpy import matplotlib.pyplot as pyplot from samme import SAMME Original_Data = numpy.array([ ['teenager', 'no',...
gpl-2.0
rolando/theusual-kaggle-seeclickfix-ensemble
Bryan/ensembles.py
2
19613
""" Classes and functions for working with base models and ensembles. """ __author__ = 'bgregory' __email__ = 'bryan.gregory1@gmail.com' __date__ = '11-23-2013' #Internal modules import utils #Start logger to record all info, warnings, and errors to Logs/logfile.log log = utils.start_logging(__name__) impor...
bsd-3-clause
dandanvidi/effective-capacity
scripts/gauge.py
3
3523
# -*- coding: utf-8 -*- """ Created on Wed Jun 22 13:58:55 2016 @author: dan """ import os, sys import matplotlib from matplotlib import cm from matplotlib import pyplot as plt import numpy as np from matplotlib.patches import Circle, Wedge, Rectangle def degree_range(n): start = np.linspace(0,180,n+1, endpoint...
mit
ezekielsilverstein/JPL
Sloan_List_Script.py
1
15678
#Numerical Python import numpy as np #Pylab Plotting import pylab import matplotlib.pyplot as plt #INTERNET #Selenium Internet Browsing from selenium import webdriver from selenium.webdriver.common.keys import Keys import os from decimal import * import time import csv #Internet import urllib2 print "Start up ...
mit
rhuelga/sms-tools
lectures/08-Sound-transformations/plots-code/stftFiltering-orchestra.py
2
1670
import numpy as np import time, os, sys import matplotlib.pyplot as plt sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../software/models/')) sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../software/transformations/')) import utilFunctions as UF impo...
agpl-3.0
12yujim/pymtl
pymtl/tools/simulation/SimulationMetrics.py
8
8999
#========================================================================= # SimulationMetrics.py #========================================================================= from __future__ import print_function import pickle #------------------------------------------------------------------------- # SimulationMetri...
bsd-3-clause
numenta-archive/htmresearch
projects/dp1/dp_experiment1.py
3
12622
# Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2016, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This program is free software: you can redistribute it and/or modify # it under the ...
agpl-3.0
vigilv/scikit-learn
sklearn/manifold/tests/test_t_sne.py
53
21055
import sys from sklearn.externals.six.moves import cStringIO as StringIO import numpy as np import scipy.sparse as sp from sklearn.neighbors import BallTree from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_almost_equal fr...
bsd-3-clause
Twangist/log_calls
tests/test_with_sklearn/test_decorate_sklearn_KMeans_functions.py
1
6482
__author__ = 'brianoneill' ############################################################################### def test_deco_sklearn_cluster_kmeans_function(): """ Dunno how to decorate `sklearn.cluster.kmeans` so that the decorated funciton is called via `sklearn.cluster.kmeans(...)`. What gets decorated is...
mit
fspaolo/scikit-learn
examples/linear_model/plot_ols.py
8
1966
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Linear Regression Example ========================================================= This example uses the only the first feature of the `diabetes` dataset, in order to illustrate a two-dimensional plot of this regre...
bsd-3-clause
jmontoyam/mne-python
mne/preprocessing/tests/test_infomax.py
6
5969
# Authors: Denis A. Engemann <denis.engemann@gmail.com> # # License: BSD (3-clause) """ Test the infomax algorithm. Parts of this code are taken from scikit-learn """ import numpy as np from numpy.testing import assert_almost_equal from scipy import stats from scipy import linalg from mne.preprocessing.infomax_ imp...
bsd-3-clause
MTgeophysics/mtpy
tests/SmartMT/test_exportDialog.py
1
12640
import os from unittest import TestCase import matplotlib.pyplot as plt import numpy as np from qtpy import QtCore from qtpy.QtWidgets import QFileDialog, QMessageBox, QDialog from qtpy.QtTest import QTest from mtpy.gui.SmartMT.gui.export_dialog import ExportDialog, IMAGE_FORMATS from tests import make_temp_dir from ...
gpl-3.0
cmcantalupo/geopm
integration/experiment/power_sweep/gen_power_sweep_summary.py
1
3310
#!/usr/bin/env python # # Copyright (c) 2015 - 2021, Intel Corporation # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyright # notice, thi...
bsd-3-clause
theroncarmichael/GC-CaT-Metallicitiy
interp.py
1
9342
#! /usr/bin/env python ''' Created on Mar 17, 2011 @author: Chris Usher ''' import numpy as np #import matplotlib.pyplot as plt import scipy.interpolate as interpolate def redisperse(inputwavelengths, inputfluxes, firstWavelength=None, lastWavelength=None, dispersion=None, nPixels=None, outside=None, function='splin...
bsd-3-clause
mikechan0731/tunnel_calculation
forTR_ver4.py
1
12948
# C:\Python27\Scripts # -*- coding: utf-8 -*- # Author : MikeChan # Email : m7807031@gmail.com import pandas as pd import numpy as np from scipy import optimize import xlrd, os from time import sleep, time import matplotlib.pyplot as plt import FileDialog #===== helper func. ===== def draw_parsley_ver4(t=0.05): ...
apache-2.0
jmsolano/picongpu
examples/ThermalTest/tools/dispersion.py
11
2689
#!/usr/bin/env python # # Copyright 2013 Heiko Burau, Axel Huebl # # This file is part of PIConGPU. # # PIConGPU 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 o...
gpl-3.0
chenyyx/scikit-learn-doc-zh
examples/en/feature_selection/plot_select_from_model_boston.py
146
1527
""" =================================================== Feature selection using SelectFromModel and LassoCV =================================================== Use SelectFromModel meta-transformer along with Lasso to select the best couple of features from the Boston dataset. """ # Author: Manoj Kumar <mks542@nyu.edu>...
gpl-3.0
themrmax/scikit-learn
examples/feature_selection/plot_feature_selection_pipeline.py
58
1049
""" ================== Pipeline Anova SVM ================== Simple usage of Pipeline that runs successively a univariate feature selection with anova and then a C-SVM of the selected features. """ from sklearn import svm from sklearn.datasets import samples_generator from sklearn.feature_selection import SelectKBest,...
bsd-3-clause
rileyrustad/pdxapartmentfinder
pipeline/crawler.py
1
2738
# -*- coding: utf-8 -*- """ Created on Thu Jan 7 10:59:34 2016 @author: Riley Rustad <rileyrustad@gmail.com> This Script is designed to scrape data from Multnomah County apartment ads from Craigslist. """ # ============================================================================= # Imports import numpy as np ...
mit
logpai/logparser
logparser/Drain/Drain.py
1
12453
""" Description : This file implements the Drain algorithm for log parsing Author : LogPAI team License : MIT """ import re import os import numpy as np import pandas as pd import hashlib from datetime import datetime class Logcluster: def __init__(self, logTemplate='', logIDL=None): ...
mit
phobson/statsmodels
statsmodels/datasets/co2/data.py
3
3045
#! /usr/bin/env python """Mauna Loa Weekly Atmospheric CO2 Data""" __docformat__ = 'restructuredtext' COPYRIGHT = """This is public domain.""" TITLE = """Mauna Loa Weekly Atmospheric CO2 Data""" SOURCE = """ Data obtained from http://cdiac.ornl.gov/trends/co2/sio-keel-flask/sio-keel-flaskmlo_c.html Obt...
bsd-3-clause
abhisg/scikit-learn
examples/cross_decomposition/plot_compare_cross_decomposition.py
128
4761
""" =================================== Compare cross decomposition methods =================================== Simple usage of various cross decomposition algorithms: - PLSCanonical - PLSRegression, with multivariate response, a.k.a. PLS2 - PLSRegression, with univariate response, a.k.a. PLS1 - CCA Given 2 multivari...
bsd-3-clause
openmichigan/metrics_tools
openmichigan-metrics-pdf/ga_api_timeseries.py
1
20456
import sys import infofile import requests, json import get_material_links from pylab import * #? import numpy as np import matplotlib.pyplot as plt import matplotlib.dates as mdates from datetime import date, timedelta from apiclient.errors import HttpError from oauth2client.client import AccessTokenRefreshError imp...
mit
briney/abstar
abstar/utils/pandaseq.py
1
7169
#!/usr/bin/python # filename: pandaseq.py # # Copyright (c) 2015 Bryan Briney # License: The MIT license (http://opensource.org/licenses/MIT) # # Permission is hereby granted, free of charge, to any person obtaining a copy of this software # and associated documentation files (the "Software"), to deal in the Software ...
mit
shirtsgroup/pygo
analysis/QRE_scripts/MBAR_foldingcurve.py
1
6622
# Ellen Zhong # ellen.zhong@virginia.edu # 03/08/2014 import sys import numpy import pymbar # for MBAR analysis import timeseries # for timeseries analysis import os import os.path import pdb import wham from optparse import OptionParser def parse_args(): parser=OptionParser() parser.add_option("-r", "--repl...
gpl-2.0
sinhrks/expandas
pandas_ml/skaccessors/test/test_multioutput.py
2
1807
#!/usr/bin/env python try: import sklearn.multioutput as multioutput except ImportError: pass import numpy as np import pandas as pd import pandas_ml as pdml import pandas_ml.util.testing as tm class TestMultiOutput(tm.TestCase): def test_objectmapper(self): df = pdml.ModelFra...
bsd-3-clause
crichardson17/starburst_atlas
Low_resolution_sims/DustFree_LowRes/Padova_cont/padova_cont_5/Rest.py
33
7215
import csv import matplotlib.pyplot as plt from numpy import * import scipy.interpolate import math from pylab import * from matplotlib.ticker import MultipleLocator, FormatStrFormatter import matplotlib.patches as patches from matplotlib.path import Path import os # --------------------------------------------------...
gpl-2.0
hainm/scikit-learn
examples/mixture/plot_gmm.py
248
2817
""" ================================= Gaussian Mixture Model Ellipsoids ================================= Plot the confidence ellipsoids of a mixture of two Gaussians with EM and variational Dirichlet process. Both models have access to five components with which to fit the data. Note that the EM model will necessari...
bsd-3-clause
msultan/msmbuilder
msmbuilder/cluster/agglomerative.py
6
11834
# Author: Robert McGibbon <rmcgibbo@gmail.com> # Contributors: Brooke Husic <brookehusic@gmail.com> # Copyright (c) 2017, Stanford University # All rights reserved. #----------------------------------------------------------------------------- # Imports #----------------------------------------------------------------...
lgpl-2.1
mattilyra/scikit-learn
examples/datasets/plot_iris_dataset.py
35
1929
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= The Iris Dataset ========================================================= This data sets consists of 3 different types of irises' (Setosa, Versicolour, and Virginica) petal and sepal length, stored in a 150x4 numpy...
bsd-3-clause
cython-testbed/pandas
pandas/core/config_init.py
8
17165
""" This module is imported from the pandas package __init__.py file in order to ensure that the core.config options registered here will be available as soon as the user loads the package. if register_option is invoked inside specific modules, they will not be registered until that module is imported, which may or may...
bsd-3-clause
rl-institut/reegis-hp
reegis_hp/de21/test.py
3
1906
import pandas as pd from matplotlib import pyplot as plt import logging from oemof.tools import logger logger.define_logging() exit(0) df = pd.read_csv('/home/uwe/geo.csv', index_col='zip_code') del df['Unnamed: 0'] del df['gid'] df.to_csv('/home/uwe/git_local/reegis-hp/reegis_hp/de21/geometries/postcode.csv') exit(0...
gpl-3.0
yvesalexandre/privacy-tools
within_voronoi_translation/within_voronoi_translation.py
1
7700
#!/usr/bin/env python """ within_voronoi_translation.py: Move antennas uniformly within their voronoi cell. Noise is often added to the GPS coordinates of antennas to hinter's an attacker ability to link outside information to the released database. This code takes as input a list of antennas location and moves them ...
mit
toobaz/pandas
pandas/core/tools/timedeltas.py
2
6506
""" timedelta support tools """ import warnings import numpy as np from pandas._libs.tslibs import NaT from pandas._libs.tslibs.timedeltas import Timedelta, parse_timedelta_unit from pandas.util._decorators import deprecate_kwarg from pandas.core.dtypes.common import is_list_like from pandas.core.dtypes.generic imp...
bsd-3-clause
ManuelMBaumann/opt_tau
num_exper/mekrylov.py
1
10316
import scipy.sparse as sparse import matplotlib.pyplot as plt #import scipy.io as io import numpy as np import scipy.sparse.linalg as spla import pyamg from math import sqrt, atan, cos, sin, pi, atan2 from numpy.linalg import norm #from scipy.io import mmwrite from nutils import * from numpy.linalg import solve from s...
mit
cxxgtxy/tensorflow
tensorflow/contrib/learn/python/learn/estimators/estimator_input_test.py
72
12865
# 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
behzadnouri/scipy
scipy/optimize/nonlin.py
34
46681
r""" Nonlinear solvers ----------------- .. currentmodule:: scipy.optimize This is a collection of general-purpose nonlinear multidimensional solvers. These solvers find *x* for which *F(x) = 0*. Both *x* and *F* can be multidimensional. Routines ~~~~~~~~ Large-scale nonlinear solvers: .. autosummary:: newto...
bsd-3-clause
jakobj/UP-Tasks
NEST/single_neuron_task/single_neuron.py
3
1344
import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import nest # import NEST module def single_neuron(spike_times, sim_duration): nest.set_verbosity('M_WARNING') # reduce NEST output nest.ResetKernel() # reset simulation kernel # create LIF neuron with exponential synaptic currents...
gpl-2.0
flightgong/scikit-learn
benchmarks/bench_plot_omp_lars.py
31
4457
"""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
harisbal/pandas
pandas/tests/io/test_sql.py
3
96428
"""SQL io tests The SQL tests are broken down in different classes: - `PandasSQLTest`: base class with common methods for all test classes - Tests for the public API (only tests with sqlite3) - `_TestSQLApi` base class - `TestSQLApi`: test the public API with sqlalchemy engine - `TestSQLiteFallbackApi`: t...
bsd-3-clause
RayMick/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
rvraghav93/scikit-learn
sklearn/neural_network/rbm.py
26
12280
"""Restricted Boltzmann Machine """ # Authors: Yann N. Dauphin <dauphiya@iro.umontreal.ca> # Vlad Niculae # Gabriel Synnaeve # Lars Buitinck # License: BSD 3 clause import time import numpy as np import scipy.sparse as sp from scipy.special import expit # logistic function from ..base im...
bsd-3-clause
JackKelly/neuralnilm_prototype
scripts/e328.py
2
6737
from __future__ import print_function, division import matplotlib import logging from sys import stdout matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab! from neuralnilm import (Net, RealApplianceSource, BLSTMLayer, DimshuffleLayer, Bidirectio...
mit
kdebrab/pandas
pandas/tests/extension/base/groupby.py
3
2747
import pytest import pandas.util.testing as tm import pandas as pd from .base import BaseExtensionTests class BaseGroupbyTests(BaseExtensionTests): """Groupby-specific tests.""" def test_grouping_grouper(self, data_for_grouping): df = pd.DataFrame({ "A": ["B", "B", None, None, "A", "A", ...
bsd-3-clause
ArtezGDA/MappingTheCity-Maps
Kimberley ter Heerdt/Poster/Visual-3/wiki-birthsvisualmetdatatekst.py
1
1087
import json import matplotlib.pyplot as plt def visual_file(file_name, line_color): fig = plt.figure(1) with open(file_name, 'r') as f: data = json.load(f) for d in data: cur_births = d['birth'] for cur_birth in cur_births: year = cur_birth['year'] ...
mit
skrueger111/zazzie
src/scripts/convergence_test.py
3
31326
# from __future__ import absolute_import # from __future__ import division # from __future__ import print_function # # from __future__ import unicode_literals """SASSIE: Copyright (C) 2011-2015 Joseph E. Curtis, Ph.D. This program is free software: you can redistribute it and/or modify it under the terms of the GNU G...
gpl-3.0
Simclass/EDXD_Analysis
bin/data_creation.py
3
3978
import numpy as np import matplotlib.pyplot as plt import time from pyxe.williams import sigma_xx, sigma_yy, sigma_xy, cart2pol from pyxe.fitting_functions import strain_transformation, shear_transformation def plane_strain_s2e(sigma_xx, sigma_yy, sigma_xy, E, v, G=None): if G is None: G = E / (2 * (1 - v...
mit
jwlockhart/concept-networks
examples/draw_tripartite.py
1
3581
# @author Jeff Lockhart <jwlock@umich.edu> # Script for drawing the tripartite network underlying analysis. # version 1.0 import pandas as pd import networkx as nx import matplotlib.pyplot as plt import sys #add the parent directory to the current session's path sys.path.insert(0, '../') from network_utils import * #...
gpl-3.0
caperren/Archives
OSU Coursework/ROB 456 - Intelligent Robotics/Homework 4 - A Star Pathfinding/hw4.py
1
7720
import csv from matplotlib import pyplot, patches from math import sqrt from heapq import * CSV_PATH = "world.csv" VAL_TO_COLOR = { 0: "green", 1: "red", -1: "blue" } EDGE_COST = 1 START_POSITION = (0, 0) END_POSITION = (19, 19) def import_csv_as_array(csv_path): csv_file = open(csv_path, "rU") ...
gpl-3.0
thirdwing/mxnet
python/mxnet/model.py
4
39905
# 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
LaDO-IOUSP/Curious
Python/pizzaplot.py
1
1687
# -*- coding: UTF-8 -*- import matplotlib.pyplot as plt from matplotlib.patches import Wedge def pizzaplot(center, radius, angle=0,nb=2, ax=None, colors=[],**kwargs): ''' Plots circle with inputed number of divisions with different colors(multicolor scatter). ==================================================...
mit
belteshassar/cartopy
lib/cartopy/tests/test_polygon.py
3
17387
# (C) British Crown Copyright 2011 - 2016, Met Office # # This file is part of cartopy. # # cartopy is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the # Free Software Foundation, either version 3 of the License, or # (at your option)...
gpl-3.0
bundgus/python-playground
matplotlib-playground/examples/pylab_examples/boxplot_demo.py
2
1288
import matplotlib.pyplot as plt import numpy as np # fake up some data spread = np.random.rand(50) * 100 center = np.ones(25) * 50 flier_high = np.random.rand(10) * 100 + 100 flier_low = np.random.rand(10) * -100 data = np.concatenate((spread, center, flier_high, flier_low), 0) # basic plot plt.boxplot(data) # notch...
mit
RayMick/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
smartscheduling/scikit-learn-categorical-tree
examples/covariance/plot_lw_vs_oas.py
248
2903
""" ============================= Ledoit-Wolf vs OAS estimation ============================= The usual covariance maximum likelihood estimate can be regularized using shrinkage. Ledoit and Wolf proposed a close formula to compute the asymptotically optimal shrinkage parameter (minimizing a MSE criterion), yielding th...
bsd-3-clause
Jimmy-Morzaria/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
larsmans/seqlearn
seqlearn/datasets.py
4
3045
# Copyright 2013 Lars Buitinck from contextlib import closing from itertools import chain, groupby import numpy as np from sklearn.feature_extraction import FeatureHasher from sklearn.externals import six def load_conll(f, features, n_features=(2 ** 16), split=False): """Load CoNLL file, extract features on the...
mit
smenon8/AnimalWildlifeEstimator
script/RegressionCapsuleClass.py
1
1640
# python-3 # Regression Capsule Class # In the same lines as ClassifierCapsuleClass from sklearn.metrics import mean_absolute_error, mean_squared_error from BaseCapsuleClass import BaseCapsule from collections import OrderedDict import pandas as pd class RegressionCapsule(BaseCapsule): def __init__(self,clfObj,method...
bsd-3-clause
zingale/hydro_examples
compressible/riemann-slow-shock.py
1
1642
# plot the Hugoniot loci for a compressible Riemann problem from __future__ import print_function import matplotlib.pyplot as plt import numpy as np import riemann import matplotlib as mpl # Use LaTeX for rendering mpl.rcParams['mathtext.fontset'] = 'cm' mpl.rcParams['mathtext.rm'] = 'serif' mpl.rcParams['font.size...
bsd-3-clause
cybernet14/scikit-learn
sklearn/tree/tree.py
59
34839
""" This module gathers tree-based methods, including decision, regression and randomized trees. Single and multi-output problems are both handled. """ # Authors: Gilles Louppe <g.louppe@gmail.com> # Peter Prettenhofer <peter.prettenhofer@gmail.com> # Brian Holt <bdholt1@gmail.com> # Noel Da...
bsd-3-clause
qifeigit/scikit-learn
sklearn/linear_model/tests/test_logistic.py
105
26588
import numpy as np import scipy.sparse as sp from scipy import linalg, optimize, sparse from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_equal from sklearn.util...
bsd-3-clause
chrisburr/scikit-learn
examples/covariance/plot_covariance_estimation.py
99
5074
""" ======================================================================= Shrinkage covariance estimation: LedoitWolf vs OAS and max-likelihood ======================================================================= When working with covariance estimation, the usual approach is to use a maximum likelihood estimator,...
bsd-3-clause
wogsland/QSTK
build/lib.linux-x86_64-2.7/Bin/converter.py
5
2926
''' (c) 2011, 2012 Georgia Tech Research Corporation This source code is released under the New BSD license. Please see http://wiki.quantsoftware.org/index.php?title=QSTK_License for license details. Created on Jan 1, 2011 @author:Drew Bratcher @contact: dbratcher@gatech.edu @summary: Contains tutorial for...
bsd-3-clause
rahuldhote/scikit-learn
sklearn/utils/tests/test_fixes.py
281
1829
# Authors: Gael Varoquaux <gael.varoquaux@normalesup.org> # Justin Vincent # Lars Buitinck # License: BSD 3 clause import numpy as np from nose.tools import assert_equal from nose.tools import assert_false from nose.tools import assert_true from numpy.testing import (assert_almost_equal, ...
bsd-3-clause
toobaz/pandas
pandas/tests/arithmetic/test_timedelta64.py
2
76159
# Arithmetic tests for DataFrame/Series/Index/Array classes that should # behave identically. from datetime import datetime, timedelta import numpy as np import pytest from pandas.errors import NullFrequencyError, OutOfBoundsDatetime, PerformanceWarning import pandas as pd from pandas import ( DataFrame, Dat...
bsd-3-clause
hansomesong/TracesAnalyzer
Plot/Plot_variable_time/Pie_Chart.py
1
3974
# -* coding:UTF-8 -* # __author__ = 'yueli' import numpy as np import matplotlib.pyplot as plt # All the codes in this python file can be referenced to # http://matplotlib.org/1.2.1/examples/pylab_examples/pie_demo.html # 由于此文件的input文件已不存在,所以此文件已被Pie_chart_v4.py替代 # Import the targeted raw CSV file rawCSV_file1 = "/...
gpl-2.0
ellisonbg/altair
altair/vegalite/v2/examples/stem_and_leaf.py
1
1273
""" Stem and Leaf Plot ------------------ This example shows how to make a stem and leaf plot. """ # category: other charts import altair as alt import pandas as pd import numpy as np np.random.seed(42) # Generating random data original_data = pd.DataFrame({'samples': np.array(np.random.normal(50, 15, 100), dtype=np.i...
bsd-3-clause
potash/scikit-learn
sklearn/grid_search.py
6
38777
""" The :mod:`sklearn.grid_search` includes utilities to fine-tune the parameters of an estimator. """ from __future__ import print_function # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>, # Gael Varoquaux <gael.varoquaux@normalesup.org> # Andreas Mueller <amueller@ais.uni-bonn.de> # ...
bsd-3-clause
blbarker/spark-tk
regression-tests/sparktkregtests/testcases/graph/betweenness_centrality_test.py
4
5737
# vim: set encoding=utf-8 # Copyright (c) 2016 Intel Corporation  # # 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 require...
apache-2.0
sightmachine/SimpleCV2
SimpleCV/examples/machine-learning/machine-learning_nuts-vs-bolts.py
12
2782
''' This Example uses scikits-learn to do a binary classfication of images of nuts vs. bolts. Only the area, height, and width are used to classify the actual images but data is extracted from the images using blobs. This is a very crude example and could easily be built upon, but is just meant to give an introductor...
bsd-3-clause
Gezerj/Data-Analysis
Task-Problems/TASK 6.py
1
1263
# -*- coding: utf-8 -*- """ Created on Wed Oct 04 10:57:34 2017 @author: Gerwyn """ from __future__ import division import numpy as np import scipy.stats as sc import matplotlib.pyplot as plt P = np.array([79, 82, 85, 88, 90]) T = np.array([8, 17, 30, 37, 52]) n = len(T) N = 5000 Tmin = -500 Tmax = 0 sigma_...
gpl-3.0
CVML/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
andim/evolimmune
figSIaltphases/figure-SIaltphases.py
1
6607
# coding: utf-8 # # Influence of parameter choice on the phase diagram # To study to what extend the phase diagram depends on the cost of infection $c_{\rm inf}$, and on the trade-off shapes $c_{\rm def}(c_{\rm con}), c_{\rm uptake}(p_{\rm uptake})$ we plot the phase diagram for a number of different choices in the ...
mit
Clyde-fare/scikit-learn
sklearn/calibration.py
137
18876
"""Calibration of predicted probabilities.""" # Author: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Balazs Kegl <balazs.kegl@gmail.com> # Jan Hendrik Metzen <jhm@informatik.uni-bremen.de> # Mathieu Blondel <mathieu@mblondel.org> # # License: BSD 3 clause from __future__ impo...
bsd-3-clause
ottermegazord/ottermegazord.github.io
sortify-master/seaborn/rcmod.py
3
16173
"""Functions that alter the matplotlib rc dictionary on the fly.""" from distutils.version import LooseVersion import functools import numpy as np import matplotlib as mpl from . import palettes, _orig_rc_params mpl_ge_150 = LooseVersion(mpl.__version__) >= '1.5.0' __all__ = ["set", "reset_defaults", "reset_orig"...
mit
wdurhamh/statsmodels
statsmodels/examples/tsa/ex_var.py
33
1280
from __future__ import print_function import numpy as np import statsmodels.api as sm from statsmodels.tsa.api import VAR # some example data mdata = sm.datasets.macrodata.load().data mdata = mdata[['realgdp','realcons','realinv']] names = mdata.dtype.names data = mdata.view((float,3)) use_growthrate = False #True #...
bsd-3-clause
QInfer/python-qinfer
doc/source/conf.py
3
12884
# -*- coding: utf-8 -*- # # QInfer documentation build configuration file, created by # sphinx-quickstart on Tue Aug 14 21:12:57 2012. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All ...
bsd-3-clause
soundcloud/essentia
src/examples/tutorial/essentia_tutorial.py
10
6577
# Copyright (C) 2006-2013 Music Technology Group - Universitat Pompeu Fabra # # This file is part of Essentia # # Essentia is free software: you can redistribute it and/or modify it under # the terms of the GNU Affero General Public License as published by the Free # Software Foundation (FSF), either version 3 of the ...
agpl-3.0
zaxtax/scikit-learn
sklearn/preprocessing/tests/test_label.py
12
17807
import numpy as np from scipy.sparse import issparse from scipy.sparse import coo_matrix from scipy.sparse import csc_matrix from scipy.sparse import csr_matrix from scipy.sparse import dok_matrix from scipy.sparse import lil_matrix from sklearn.utils.multiclass import type_of_target from sklearn.utils.testing impor...
bsd-3-clause
kernc/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
laurentgo/arrow
dev/archery/archery/lang/python.py
3
7570
# 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
chetan51/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/bezier.py
70
14387
""" A module providing some utility functions regarding bezier path manipulation. """ import numpy as np from math import sqrt from matplotlib.path import Path from operator import xor # some functions def get_intersection(cx1, cy1, cos_t1, sin_t1, cx2, cy2, cos_t2, sin_t2): """ return a...
gpl-3.0
gclenaghan/scikit-learn
examples/cluster/plot_digits_linkage.py
369
2959
""" ============================================================================= Various Agglomerative Clustering on a 2D embedding of digits ============================================================================= An illustration of various linkage option for agglomerative clustering on a 2D embedding of the di...
bsd-3-clause
nikitasingh981/scikit-learn
sklearn/ensemble/tests/test_forest.py
9
43013
""" Testing for the forest module (sklearn.ensemble.forest). """ # Authors: Gilles Louppe, # Brian Holt, # Andreas Mueller, # Arnaud Joly # License: BSD 3 clause import pickle from collections import defaultdict from itertools import combinations from itertools import product import numpy ...
bsd-3-clause
alphacsc/alphacsc
examples/csc/plot_simulate_randomstate.py
1
3040
""" ============================== Selecting random state for CSC ============================== The CSC problem is non-convex. Therefore, the solution depends on the initialization. Here, we show how to select the best atoms amongst different initializations. """ # Authors: Mainak Jas <mainak.jas@telecom-paristech....
bsd-3-clause