code stringlengths 114 1.05M | path stringlengths 3 312 | quality_prob float64 0.5 0.99 | learning_prob float64 0.2 1 | filename stringlengths 3 168 | kind stringclasses 1
value |
|---|---|---|---|---|---|
# Cooking Appliances
In this example, appliances with multiple preferences index and attributes are modeled.
To have a better understanding of RAMP features for modelling these category of appliances, two households are considered:
1. First household with a fixed lunch habit of eating soup everyday.
2. Second househ... | /rampdemand-0.4.0.tar.gz/rampdemand-0.4.0/docs/notebooks/.ipynb_checkpoints/cooking_app-checkpoint.ipynb | 0.472683 | 0.938857 | cooking_app-checkpoint.ipynb | pypi |
# Appliances with occasional use
There are some appliances that are occasionally included in the mix pf appliances that the user switches-on during the day. For example, iron, stereo, printers and ...
Within ramp, the user may specify the probability of using an appliance on the daily mix with a parameter called, **o... | /rampdemand-0.4.0.tar.gz/rampdemand-0.4.0/docs/notebooks/.ipynb_checkpoints/occasional_use-checkpoint.ipynb | 0.532425 | 0.944587 | occasional_use-checkpoint.ipynb | pypi |
# Thermal loads
This example input file represents a single household user whose only load
is the "shower". The example showcases how to model thermal loads by means of
the thermal_P_var attribute.
```
# importing functions
from ramp import User,calc_peak_time_range,yearly_pattern
from ramp import load_data
import p... | /rampdemand-0.4.0.tar.gz/rampdemand-0.4.0/docs/notebooks/.ipynb_checkpoints/thermal_app-checkpoint.ipynb | 0.426322 | 0.926968 | thermal_app-checkpoint.ipynb | pypi |
# Appliances with multiple cycles
An example of an appliance with multiple cycle is fridge.
Fridges usually have different duty cycles can be estimated based on seasonal temperature trends.
In this example a fridge with 3 different duty cycles is modelled. The time windows are defined for 3 different cycles for 3 di... | /rampdemand-0.4.0.tar.gz/rampdemand-0.4.0/docs/notebooks/.ipynb_checkpoints/multi_cycle-checkpoint.ipynb | 0.412767 | 0.987616 | multi_cycle-checkpoint.ipynb | pypi |
Cooking Appliances
==================
In this example, appliances with multiple preferences index and
attributes are modeled.
To have a better understanding of RAMP features for modelling these
category of appliances, two households are considered:
1. First household with a fixed lunch habit of eating soup everyday.... | /rampdemand-0.4.0.tar.gz/rampdemand-0.4.0/docs/source/examples/cooking_app/cooking_app.rst | 0.663015 | 0.686265 | cooking_app.rst | pypi |
# Appliances with multiple cycles
An example of an appliance with multiple cycle is fridge.
Fridges usually have different duty cycles can be estimated based on seasonal temperature trends.
In this example a fridge with 3 different duty cycles is modelled. The time windows are defined for 3 different cycles for 3 di... | /rampdemand-0.4.0.tar.gz/rampdemand-0.4.0/docs/build/html/_static/notebooks/multi cycle.ipynb | 0.429908 | 0.988917 | multi cycle.ipynb | pypi |
# Appliances with occasional use
There are some appliances that are occasionally included in the mix pf appliances that the user switches-on during the day. For example, iron, stereo, printers and ...
Within ramp, the user may specify the probability of using an appliance on the daily mix with a parameter called, **o... | /rampdemand-0.4.0.tar.gz/rampdemand-0.4.0/docs/build/html/_static/notebooks/occasional_use.ipynb | 0.557364 | 0.946941 | occasional_use.ipynb | pypi |
# Appliances with multiple cycles
An example of an appliance with multiple cycle is fridge.
Fridges usually have different duty cycles can be estimated based on seasonal temperature trends.
In this example a fridge with 3 different duty cycles is modelled. The time windows are defined for 3 different cycles for 3 di... | /rampdemand-0.4.0.tar.gz/rampdemand-0.4.0/docs/build/html/_static/notebooks/multi_cycle.ipynb | 0.429908 | 0.988917 | multi_cycle.ipynb | pypi |
# Thermal loads
....
In this example, a household whose its only load is the shower.
```
# importing functions
from ramp import User,calc_peak_time_range,yearly_pattern
from ramp import load_data
import pandas as pd
```
### Creating a user category and appliances
```
household = User()
```
when the power is varia... | /rampdemand-0.4.0.tar.gz/rampdemand-0.4.0/docs/build/html/_static/notebooks/thermal_app.ipynb | 0.422028 | 0.900092 | thermal_app.ipynb | pypi |
# Cooking Appliances
In this example, appliances with multiple preferences index and attributes are modeled.
To have a better understanding of RAMP features for modelling these category of appliances, two households are considered:
1. First household with a fixed lunch habit of eating soup everyday.
2. Second househ... | /rampdemand-0.4.0.tar.gz/rampdemand-0.4.0/docs/build/html/_static/notebooks/Cooking_app.ipynb | 0.472683 | 0.9434 | Cooking_app.ipynb | pypi |
def switch_on_parameters():
"""
Calibration parameters. These can be changed in case the user has some real data against which the model can be calibrated
They regulate the probability of coincident switch-on within the peak window
mu_peak corresponds to \mu_{%} in [1], p.8
s_peak corresponds to \s... | /rampdemand-0.4.0.tar.gz/rampdemand-0.4.0/ramp/core/constants.py | 0.879289 | 0.651854 | constants.py | pypi |
#%% Import required libraries
import numpy as np
import random
import math
from ramp.core.initialise import initialise_inputs
from ramp.core.core import UseCase
#%% Core model stochastic script
def calc_peak_time_range(user_list, peak_enlarge=0.15):
"""
Calculate the peak time range, which is used to discr... | /rampdemand-0.4.0.tar.gz/rampdemand-0.4.0/ramp/core/stochastic_process.py | 0.880219 | 0.718545 | stochastic_process.py | pypi |
import json
import random
import time
import numpy as np
import pandas as pd
from openpyxl import load_workbook
from openpyxl.worksheet.cell_range import CellRange
POSSIBLE_FORMATS = """
The possible formats of the power timeseries are :
- a single value (int or float) if the power is constant throughout t... | /rampdemand-0.4.0.tar.gz/rampdemand-0.4.0/ramp/core/utils.py | 0.715523 | 0.619385 | utils.py | pypi |
<!--
SPDX-FileCopyrightText: 2021 Magenta ApS <https://magenta.dk>
SPDX-License-Identifier: MPL-2.0
-->
# Rammearkitektur AMQP
Rammearkitektur AMQP (RAMQP) is an opinionated library for AMQP.
It is implemented as a thin wrapper around `aio_pika`, with a generic and a MO
specific AMQPSystem abstract, the MO abstractio... | /ramqp-9.0.2.tar.gz/ramqp-9.0.2/README.md | 0.588534 | 0.681992 | README.md | pypi |
from .brain_pb2 import Job, Jobs, Target, Commands
from .checks import verify
from .connection import rethinkdb as r
from .connection import connect
from decorator import decorator
RBT = r.db("Brain").table("Targets")
RBJ = r.db("Brain").table("Jobs")
RBO = r.db("Brain").table("Outputs")
RPX = r.db("Plugins")
@decora... | /ramrodbrain-0.1.68.tar.gz/ramrodbrain-0.1.68/brain/queries.py | 0.694821 | 0.18866 | queries.py | pypi |
from time import sleep, time
from uuid import uuid4
import rethinkdb
from rethinkdb.net import DefaultConnection
from decorator import decorator
from .environment import check_stage_env
from .static import BRAIN_DB, PLUGINDB, JOBS, TARGETS, OUTPUTS,\
PROD, QA, DEV, TESTING
# Recursive imports at bottom of file
S... | /ramrodbrain-0.1.68.tar.gz/ramrodbrain-0.1.68/brain/connection.py | 0.618665 | 0.256424 | connection.py | pypi |
from decorator import decorator
from .decorators import verify_jobs_args_is_tuple, verify_jobs_args_length
from .brain_pb2 import Job, Jobs
from .checks import verify
from .static import BEGIN, INVALID, VALID, READY, STOP, PENDING, \
DONE, ERROR, WAITING, ACTIVE, SUCCESS, FAILURE, TRANSITION, \
COMMAND_FIELD, I... | /ramrodbrain-0.1.68.tar.gz/ramrodbrain-0.1.68/brain/jobs.py | 0.644561 | 0.200773 | jobs.py | pypi |
from decorator import decorator
from ..connection import rethinkdb as r, connect
from ..connection import validate_get_dbs
WRAP_RETHINK_ERRORS = (r.errors.ReqlOpFailedError,
r.errors.ReqlError,
r.errors.ReqlDriverError)
@decorator
def wrap_job_cursor(func_, *args, **kwa... | /ramrodbrain-0.1.68.tar.gz/ramrodbrain-0.1.68/brain/queries/decorators.py | 0.675122 | 0.269187 | decorators.py | pypi |
from ..brain_pb2 import Jobs, Target, Commands
from ..checks import verify
from ..jobs import WAITING, READY, STATES, transition_success, transition_fail
from ..connection import rethinkdb as r
from ..decorators import deprecated_function
from ..static import START_FIELD, STATUS_FIELD, ID_FIELD, OUTPUTJOB_FIELD, \
... | /ramrodbrain-0.1.68.tar.gz/ramrodbrain-0.1.68/brain/queries/writes.py | 0.509032 | 0.207857 | writes.py | pypi |
"""RAMSES RF - a RAMSES-II protocol decoder & analyser."""
from __future__ import annotations
from types import SimpleNamespace
from .protocol.const import ( # noqa: F401
DEFAULT_MAX_ZONES,
DEVICE_ID_REGEX,
DOMAIN_TYPE_MAP,
FAN_MODE,
SYS_MODE_MAP,
SZ_ACTUATORS,
SZ_AIR_QUALITY,
SZ_AIR_... | /ramses-rf-0.22.40.tar.gz/ramses-rf-0.22.40/ramses_rf/const.py | 0.736211 | 0.176423 | const.py | pypi |
# Coding Conventions
This document describes the coding standards to be adhered to by developers on
the [RAMSTK Project](https://github.com/weibullguy/ramstk). It is a working document
and suggested changes shall be submitted as issues in the RAMSTK GitHub issue
tracker with an Enhancement label attached.
[Naming Co... | /RAMSTK-1.0.1.tar.gz/RAMSTK-1.0.1/docs/CODING_STDS.md | 0.879237 | 0.89115 | CODING_STDS.md | pypi |
import math
import matplotlib.pyplot as plt
from .Generaldistribution import Distribution
class Gaussian(Distribution):
""" Gaussian distribution class for calculating and
visualizing a Gaussian distribution.
Attributes:
mean (float) representing the mean value of the distribution
stdev (float) representing ... | /ramziiss_distributions-0.1.tar.gz/ramziiss_distributions-0.1/ramziiss_distributions/Gaussiandistribution.py | 0.688364 | 0.853058 | Gaussiandistribution.py | pypi |
# DCEF - Data Cleaning Exploration Framework
We all know how awkward it is to clean data in jupyter notebooks. Multiple cells of exploratory work, trying different transforms, looking up different transforms, adhoc functions that work in one notebook and have to be either copied/pasta-ed to the next notebook, or rewri... | /ranch_hand-0.2.5.tar.gz/ranch_hand-0.2.5/README.md | 0.610105 | 0.986044 | README.md | pypi |
import pandas as pd
import numpy as np
from .lispy import make_interpreter, s
import json
def dropcol(df, col):
df.drop(col, axis=1, inplace=True)
return df
def fillna(df, col, val):
df.fillna({col:val}, inplace=True)
return df
sample_df = pd.DataFrame({'a':[2,None], 'b':['3', 'a'], 'c':[5, None]})
... | /ranch_hand-0.2.5.tar.gz/ranch_hand-0.2.5/dcef/dcf_transform.py | 0.45423 | 0.432423 | dcf_transform.py | pypi |
<!-- PROJECT SHIELDS -->
<!--
*** I'm using markdown "reference style" links for readability.
*** Reference links are enclosed in brackets [ ] instead of parentheses ( ).
*** See the bottom of this document for the declaration of the reference variables
*** for contributors-url, forks-url, etc. This is an optional, ... | /rancoord-0.0.6.tar.gz/rancoord-0.0.6/README.md | 0.528777 | 0.837686 | README.md | pypi |
from time import perf_counter
from PIL import Image
from scipy.signal import convolve2d
import numpy as np
if __name__ == "__main__":
ti = perf_counter()
def create_gen(list_, width):
"""
Yields a generator for splitting a list into equal segments of length `width`.
Arguments:
list_: The lis... | /rand_convolve-1.0.7-py3-none-any.whl/rand_convolve/rand_c.py | 0.892609 | 0.657085 | rand_c.py | pypi |
# In[1]:
import numpy as np
import numpy.random as random
# In[2]:
def random_number_generator(n,distribution,*params):
if len(params)>2:
print('Too many parameters')
else:
print('Printing', n ,'random numbers')
if distribution == 'uniform':
print('Gene... | /rand_number_gen-0.1-py3-none-any.whl/rand_number__gen/__init__.py | 0.589835 | 0.351089 | __init__.py | pypi |
from gql import gql, Client
from gql.transport.requests import RequestsHTTPTransport
import pandas as pd
from datetime import datetime
import time
def create_query(address, fromdate, first_value=1000, skip_value=0):
first = f"first: {first_value}" if first_value > 0 else ""
skip = f"skip: {skip_value}" if ski... | /rand-uniswap-yield-2.4.1.tar.gz/rand-uniswap-yield-2.4.1/backtest/graphql_query.py | 0.553264 | 0.253977 | graphql_query.py | pypi |
======================================================
``RandAssign``: Randomized assignments with PythonTeX
======================================================
:Author: Geoffrey M. Poore
:License: `BSD 3-Clause <http://opensource.org/licenses/BSD-3-Clause>`_
Create randomized assignments with solutions/keys usin... | /randassign-1.0.1.zip/randassign-1.0.1/README.rst | 0.873309 | 0.733285 | README.rst | pypi |
import random as r
import math as m
def randCoor():
"""Returns a random position"""
lon = r.uniform(-180,180)
return (r.uniform(-90,90), lon if lon != -180 else 180)
def randCoorByDist(position, distanceMax, distanceMin=0):
"""Returns a random position that is situated between distanceMin km and dista... | /randcoor-0.3.0.tar.gz/randcoor-0.3.0/src/randcoor.py | 0.61451 | 0.528412 | randcoor.py | pypi |
import random
from randgen_maptools import coord_to_1d_index
__author__ = 'Dan Alexander'
__email__ = 'lxndrdagreat@gmail.com'
__version__ = '0.1.1'
"""
Parameter Schema
"""
schema = {
'width': {
'type': 'integer',
'min': 25,
'coerce': int,
'required': True,
'default': 50... | /randgen_generator_bsp-0.1.1.tar.gz/randgen_generator_bsp-0.1.1/randgen_generator_bsp/__init__.py | 0.482429 | 0.304856 | __init__.py | pypi |
import random
from randgen_maptools import coord_to_1d_index
from randgen_generator_bsp import bsp_rect, tunnel
__author__ = 'Dan Alexander'
__email__ = 'lxndrdagreat@gmail.com'
__version__ = '0.1.2'
"""
Parameter Schema
"""
schema = {
'width': {
'type': 'integer',
'coerce': int,
'min': 2... | /randgen_generator_bsp2-0.1.2.tar.gz/randgen_generator_bsp2-0.1.2/randgen_generator_bsp2/__init__.py | 0.503906 | 0.226313 | __init__.py | pypi |
import numpy as np
import scipy.signal as signal
import multiprocessing
class FroCorr:
"""An implementation the Frobenius-norm-of-correlation-matricies metric.
This is not a class to be instantiated, but rather a way to organize and separate the
parameterization and comparison steps of the metric calcula... | /randlemur-0.06.tar.gz/randlemur-0.06/lemur/metrics.py | 0.955889 | 0.890151 | metrics.py | pypi |
from sklearn.manifold import TSNE, MDS
import pandas as pd
import numpy as np
import lemur.datasets as lds
class BaseEmbedder:
"""A generic embedder object to be extended.
Parameters
----------
num_components : int
The number of dimensions the embedding should have.
Attributes
----------
... | /randlemur-0.06.tar.gz/randlemur-0.06/lemur/embedders.py | 0.962027 | 0.64526 | embedders.py | pypi |
import os
import boto3
import pandas as pd
import numpy as np
import pickle as pkl
import logging
import json
import glob
from nilearn import image as nimage
from nilearn import plotting as nilplot
import nibabel as nib
class DataSet:
def __init__(self, D, name="default"):
self.D = D
self.n, self.... | /randlemur-0.06.tar.gz/randlemur-0.06/lemur/datasets.py | 0.643553 | 0.245746 | datasets.py | pypi |
from sklearn.ensemble import RandomForestClassifier
from sklearn.utils.validation import check_is_fitted
import numpy as np
import pandas as pd
class RandomRFE(object):
"""
随机递归特征消除。递归特征消除是通过不断训练模型将最不重要的特征删除,直到停止条件为止。
这种贪心策略较容易陷入局部最优。在此贪心策略的基础上引入随机因子,当特征重要性都不为0时,我们有一定的
概率对特征进行随机删除,当执行随机特征删除的时候,越重要的特征被... | /random_RFE-0.1.0.tar.gz/random_RFE-0.1.0/feature_selectors/RFE.py | 0.493409 | 0.553083 | RFE.py | pypi |
# Random Address
This is a tool to retrieve a real address from a list of real of random addresses that geocode successfully (tested on Google's Geocoding API service). The address data comes from the OpenAddresses project, and all the addresses are in the public domain. The addresses are deliberately not linked to pe... | /random-address-1.1.1.tar.gz/random-address-1.1.1/README.md | 0.682679 | 0.950273 | README.md | pypi |
import os
from PIL import Image, ImageDraw
from random import choices, shuffle
import argparse
from pathlib import Path
def chunk(seq, size, groupByList=True):
"""Returns list of lists/tuples broken up by size input"""
func = tuple
if groupByList:
func = list
return [func(seq[i: i + size]) for... | /random_colors-0.1.0-py3-none-any.whl/random_colors/main.py | 0.671255 | 0.417509 | main.py | pypi |
from random import randint, uniform, getrandbits, choice, shuffle
from typing import Callable, List, Tuple, Dict
from string import ascii_uppercase, digits
from itertools import product
import numpy as np
import pandas as pd
import sys
def random_int() -> int:
"""Return a random integer."""
return randint(-sy... | /random_dict-1.0.4.tar.gz/random_dict-1.0.4/random_dict/random_dict.py | 0.876198 | 0.407068 | random_dict.py | pypi |
import math
import matplotlib.pyplot as plt
from .Generaldistribution import Distribution
class Gaussian(Distribution):
""" Gaussian distribution class for calculating and
visualizing a Gaussian distribution.
Attributes:
mean (float) representing the mean value of the distribution
stdev (float) representing ... | /random%20distributions-0.1.tar.gz/random distributions-0.1/random distributions/Gaussiandistribution.py | 0.688364 | 0.853058 | Gaussiandistribution.py | pypi |
from datetime import datetime
from random import random, randint
def date(start: str, end: str, n=None) -> list[str] | str:
"""
Generate a random date between `start` and `end` dates.
:param str start: start date in the format YYYY-MM-DD.
:param str end: end date in the format YYYY-MM-DD.... | /random_filters-1.6.0.tar.gz/random_filters-1.6.0/src/random_filters/random_date.py | 0.821152 | 0.390621 | random_date.py | pypi |
import math
import sys
import warnings
from typing import Any, Dict, List, Optional, Tuple, Union
import numpy as np
import pandas as pd
import statsmodels.api as sm
from sklearn.model_selection import LeaveOneOut
def has_nas(x: pd.DataFrame) -> bool:
return x.isnull().values.any()
def get_sampsize(forest, x: ... | /random_forestry-0.10.0b1-cp38-cp38-macosx_10_9_x86_64.whl/random_forestry/preprocessing.py | 0.77552 | 0.641366 | preprocessing.py | pypi |
import warnings
from typing import Final, List, Union
import numpy as np
import pandas as pd
from .. import preprocessing
from .base_validator import BaseValidator
class PredictValidator(BaseValidator):
DEFAULT_NEWDATA: Final = None
DEFAULT_AGGREGATION: Final[str] = "average"
def get_newdata(self, *ar... | /random_forestry-0.10.0b1-cp38-cp38-macosx_10_9_x86_64.whl/random_forestry/validators/predict_validator.py | 0.841565 | 0.322459 | predict_validator.py | pypi |
import numpy as np
import pandas as pd
from .. import preprocessing
from .base_validator import BaseValidator
class FitValidator(BaseValidator):
def validate_monotonic_constraints(self, *args, **kwargs):
_self = args[0]
x = pd.DataFrame(kwargs.get("x", args[1])).copy()
_, ncols = x.shap... | /random_forestry-0.10.0b1-cp38-cp38-macosx_10_9_x86_64.whl/random_forestry/validators/fit_validator.py | 0.71123 | 0.390708 | fit_validator.py | pypi |
import numpy as np
import torch
from torch import Tensor
def sample_b(sigma: float, size: tuple) -> Tensor:
r"""Matrix of size :attr:`size` sampled from from :math:`\mathcal{N}(0, \sigma^2)`
Args:
sigma (float): standard deviation
size (tuple): size of the matrix sampled
See :class:`~rf... | /random-fourier-features-pytorch-1.0.1.tar.gz/random-fourier-features-pytorch-1.0.1/rff/functional.py | 0.96317 | 0.968441 | functional.py | pypi |
import torch.nn as nn
from typing import Optional
from torch import Tensor
import rff
class GaussianEncoding(nn.Module):
"""Layer for mapping coordinates using random Fourier features"""
def __init__(self, sigma: Optional[float] = None,
input_size: Optional[float] = None,
e... | /random-fourier-features-pytorch-1.0.1.tar.gz/random-fourier-features-pytorch-1.0.1/rff/layers.py | 0.965916 | 0.734667 | layers.py | pypi |
from pyspark import SparkContext
import time
import random
import logging as logger
from machinelearning.metrics import MLMetrics
from machinelearning.tree.decision_tree import DecisionTree
class RandomForest:
def __init__(self,num_trees, m_try, target):
self.num_trees = num_trees
self.m_try = ... | /random-genetic-forest-0.0a2.tar.gz/random-genetic-forest-0.0a2/machinelearning/randomforest.py | 0.612773 | 0.37502 | randomforest.py | pypi |
from prettytable import PrettyTable
from statistics import mean
class MLMetrics:
@staticmethod
def f_measure(precision,recall):
return 2 * ((precision*recall)/(precision+recall))
@staticmethod
def precision(true_positives,false_positives):
return true_positives/(true_positives + false... | /random-genetic-forest-0.0a2.tar.gz/random-genetic-forest-0.0a2/machinelearning/metrics.py | 0.564098 | 0.404331 | metrics.py | pypi |
import math
class StatisticsCalculator:
def attribute_entropy(self):
pass
@staticmethod
def get_probabilities(examples,attribute):
size = len(examples)
counts = {}
probabilities = []
for example in examples:
count = counts.get(str(example[attribute]))
... | /random-genetic-forest-0.0a2.tar.gz/random-genetic-forest-0.0a2/machinelearning/stats/spark/statistics_calculator.py | 0.795261 | 0.647603 | statistics_calculator.py | pypi |
import logging as logger
import math
from bitstring import BitArray, Bits
import random
class GeneticAlgorithm:
MAX_MUTATION_RANGE = 10000
def __init__(self, encoding_length, init_population_size,mutation_rate):
self.encoding_length = encoding_length
self.max_encodings = math.factorial(enco... | /random-genetic-forest-0.0a2.tar.gz/random-genetic-forest-0.0a2/machinelearning/optimization/genetic_algorithm.py | 0.452052 | 0.384594 | genetic_algorithm.py | pypi |
import logging as logger
import time
from machinelearning.stats.spark.statistics_calculator import CategoricalStatisticsCalculator, \
ContinuousStatisticsCalculator, StatisticsCalculator
from machinelearning.tree.general_tree import GeneralTree
from machinelearning.tree.node.branch import Branch
from machinelearni... | /random-genetic-forest-0.0a2.tar.gz/random-genetic-forest-0.0a2/machinelearning/tree/decision_tree.py | 0.709321 | 0.563918 | decision_tree.py | pypi |
import math
import random
from random_geometry_points.geometry import Geometry
from random_geometry_points.validation import check_geometry_parameter, check_radius
class Circle2D(Geometry):
"""Class to generate random points lying on a 2D circle.
The 2D circle is represented by the following equation:
... | /random_geometry_points-1.1.2.tar.gz/random_geometry_points-1.1.2/random_geometry_points/circle2d.py | 0.949177 | 0.824002 | circle2d.py | pypi |
import math
import random
from random_geometry_points.geometry import Geometry
from random_geometry_points.validation import check_geometry_parameter, check_radius
class Sphere(Geometry):
"""Class to generate random points lying on a sphere.
The sphere is represented by the following equation:
radius... | /random_geometry_points-1.1.2.tar.gz/random_geometry_points-1.1.2/random_geometry_points/sphere.py | 0.937697 | 0.854582 | sphere.py | pypi |
import math
from functools import reduce
def check_number_of_random_points(num_points):
"""Check the number of random points to create for a geometry.
The number of points must be of type int and its value must be
greater than zero and less than 100000.
Args:
num_points (any): The parameter wh... | /random_geometry_points-1.1.2.tar.gz/random_geometry_points-1.1.2/random_geometry_points/validation.py | 0.928684 | 0.788583 | validation.py | pypi |
import math
import random
from random_geometry_points.geometry import Geometry
from random_geometry_points.validation import check_geometry_parameter, \
check_vector, check_direction_vector, check_radius
from random_geometry_points.vector_math import normalize_vector, \
calc_dot_product, calc_perpendicular_vector, ... | /random_geometry_points-1.1.2.tar.gz/random_geometry_points-1.1.2/random_geometry_points/plane.py | 0.935088 | 0.814864 | plane.py | pypi |
import math
from functools import reduce
from random_geometry_points.validation import check_vector, check_geometry_parameter, \
check_direction_vector, check_quaternion
def calc_magnitude(vec):
"""Calculate the magnitude of a 3D vector.
Args:
vec (tuple (float, float, float)): The 3D vector whose m... | /random_geometry_points-1.1.2.tar.gz/random_geometry_points-1.1.2/random_geometry_points/vector_math.py | 0.941419 | 0.809088 | vector_math.py | pypi |
from typing import Literal, get_args
HTTP_VERSION_TYPE = Literal[1, 2] # Supported http versions
GENERATOR_TYPE = Literal['scrape', 'program', 'file'] # Type of user agent generator to be used
INPUT_TYPE = Literal['browser', 'device', 'count... | /random-header-generator-1.2.tar.gz/random-header-generator-1.2/random_header_generator/definitions.py | 0.690872 | 0.201087 | definitions.py | pypi |
from ..definitions import UNKNOWN_NAME, UNKNOWN_VERSION, PARSER_TYPE, PARSERS, EMPTY
from typing import Dict, Tuple
from abc import ABC, abstractmethod
from ..ua_parser import Parser, Dataclass
from ..utils import readFile
from dataclasses import fields
class Proxy(ABC):
""" Abstr... | /random-header-generator-1.2.tar.gz/random-header-generator-1.2/random_header_generator/ua_generator/proxies.py | 0.723505 | 0.316435 | proxies.py | pypi |
from dataclasses import fields
from ..utils import Singleton
from . import regexes as r
from . import datatypes as dtypes
from typing import Tuple, Union, Callable, List, Type, cast
from ..definitions import UNKNOWN_NAME, UNKNOWN_VERSION, PARSER_TYPE, PARSERS
import re
cla... | /random-header-generator-1.2.tar.gz/random-header-generator-1.2/random_header_generator/ua_parser/parser.py | 0.760206 | 0.378172 | parser.py | pypi |
import json
import os
from typing import Dict
import numpy as np
import pandas as pd
from codicefiscale import codicefiscale
from .utils import random_birthday
class RandomItalianPerson:
municipalities = None
names = None
surnames = None
addresses = None
def __init__(self):
"""Create a... | /random_italian_person-1.0.6.tar.gz/random_italian_person-1.0.6/random_italian_person/random_italian_person.py | 0.651798 | 0.163079 | random_italian_person.py | pypi |
import random
from normalize import normalize
from typing import TypedDict, Optional, Callable, Union
class Options(TypedDict):
maxLength: Optional[int]
min: Optional[int]
max: Optional[int]
exactly: Optional[int]
namesPerString: Optional[int]
separator: Optional[str]
join: Optional[str]
... | /random-movie-names-1.0.1.tar.gz/random-movie-names-1.0.1/src/random-movie-names.py | 0.790045 | 0.22891 | random-movie-names.py | pypi |
from typing import Any, List
from random_names.utils.files_utils import find_file
NAMES: List[str] = []
FILE = "clean_ten_k.txt"
def initialize() -> None:
"""Read name file lazily"""
if NAMES:
return
# words_path = find_file("most-common-nouns-english.csv",__file__)
# source: https://www.m... | /random_names-0.2.0.tar.gz/random_names-0.2.0/random_names/make_name.py | 0.437343 | 0.265309 | make_name.py | pypi |
adjectives = [
"admiring",
"adoring",
"affectionate",
"agitated",
"amazing",
"angry",
"awesome",
"beautiful",
"blissful",
"bold",
"boring",
"brave",
"busy",
"charming",
"clever",
"cool",
"compassionate",
"competent",
"condescending",
"confi... | /random_names-0.2.0.tar.gz/random_names-0.2.0/random_names/docker_style.py | 0.487063 | 0.588061 | docker_style.py | pypi |
import logging
from typing import Any, Dict
LOGGER = logging.getLogger(__name__)
def must_not_be_none(value: Any, message: str = "Value must not be none") -> None:
"""
Raise exception if value is None
"""
if value is None:
LOGGER.error(f"Can't be none, but got {value}")
raise TypeErro... | /random_names-0.2.0.tar.gz/random_names-0.2.0/random_names/utils/guards.py | 0.665737 | 0.167185 | guards.py | pypi |
import random
class RandomNumberList:
"""
Class for checking input that has several different checkers within it.
All numbers must be greater than zero.
"""
def __init__(self, number, pick, put_back=False):
"""
Checks if the given input is valid with the provided criteria:
... | /random_number_list-0.0.1-py3-none-any.whl/random_number_list.py | 0.748628 | 0.477006 | random_number_list.py | pypi |
import os
import sys
import argparse
import itertools
import requests
import random
from bs4 import BeautifulSoup
PORTS_OPTIONS = {
"well-known" : ("Well-known ports",),
"registered" : ("Registered ports",),
"dynamic" : ("Dynamic, private or ephemeral ports",)
}
PORTS_OPTIONS['static'] = tuple(itertools.c... | /random-open-port-0.0.3.tar.gz/random-open-port-0.0.3/random_open_port/random_open_port.py | 0.616128 | 0.197483 | random_open_port.py | pypi |
import hashlib
import math
import random
import secrets
import string
from typing import Optional
import click
import requests
from random_password_generator import messages as msg, version, name_desc
_password_entropy_table = """
Password strength is determined with this chart:
< 28 bits\t= Very Weak; might keep ou... | /random-password-generator-cli-1.0.3.tar.gz/random-password-generator-cli-1.0.3/random_password_generator/rpg.py | 0.756897 | 0.189484 | rpg.py | pypi |
import click
class Prints:
"""Prints class PRINTS messages in various format"""
@staticmethod
def emphasis(msg: str) -> None:
"""
Print emphasis messages.
:param str msg: message to print
:return: None
"""
click.echo(click.style(msg, fg="cyan"))
@stati... | /random-password-generator-cli-1.0.3.tar.gz/random-password-generator-cli-1.0.3/random_password_generator/messages/__init__.py | 0.726037 | 0.17427 | __init__.py | pypi |
import string
from copy import deepcopy
from random import shuffle, randint
try:
from secrets import choice
except ImportError:
from random import choice
class PasswordGenerator:
"""
We can set properties such as
| minlen | Minimum length of the password | 6\n
| maxlen | Maximum... | /random_password_generator-2.2.0-py3-none-any.whl/password_generator.py | 0.623262 | 0.322953 | password_generator.py | pypi |
import random
from datetime import date, timedelta
class RandomPESEL(object):
__MIN_AGE = 0
__MAX_AGE = 99
__CHECKSUM_WEIGHTS = [1, 3, 7, 9, 1, 3, 7, 9, 1, 3]
def generate(self, gender=None, min_age=__MIN_AGE, max_age=__MAX_AGE):
"""Generate random PESEL number
:param gender: Gender
... | /random_pesel-1.0-py3-none-any.whl/random_pesel/random_pesel.py | 0.68784 | 0.286185 | random_pesel.py | pypi |
import json
import random
from shapely.geometry import mapping, MultiPolygon, Point, Polygon
from typing import List, Union
class PointsGenerator:
"""Generate random points on surface
Attributes:
surface: A Polygon/MultiPolygon
points: List of random points on surface
"""
__slots__ =... | /random_points_on_polygon-0.0.3-py3-none-any.whl/random_points_on_polygon/points_generator.py | 0.902754 | 0.526525 | points_generator.py | pypi |
from shapely.geometry import shape
# Polygon without holes
POLYGON_SAMPLE_1 = shape(
{
"type": "Polygon",
"coordinates": [
[
[-73.9932632446289, 40.737892702684064],
[-73.9815902709961, 40.743355347975395],
[-73.96476745605469, 40.7665015... | /random_points_on_polygon-0.0.3-py3-none-any.whl/random_points_on_polygon/samples/samples.py | 0.404272 | 0.367327 | samples.py | pypi |
import os
import sys
import uuid
import random
from typing import List, Tuple
sys.path.append('.')
from random_profile.enums.gender import Gender
from random_profile import utils
VERSION = '3.0.1'
lname_txt = os.path.join(utils.ASSETS_DIR, "lnames.txt")
fname_male_txt = os.path.join(utils.ASSETS_DIR, "fnames_male.t... | /random_profile-3.0.1-py3-none-any.whl/random_profile/main.py | 0.497803 | 0.216674 | main.py | pypi |
badge_list = [
"[](https://forthebadge.com)",
"[](https://forthebadge.com)",
"[](... | /random-readme-badges-0.1.0.tar.gz/random-readme-badges-0.1.0/random_readme_badges/models.py | 0.445047 | 0.985896 | models.py | pypi |
import exrex
import re
from toolz import curried
from toolz.functoolz import pipe
from .random_pattern import PatternGenerator
class RegexGenerator:
"""
Generating random regex,
its complexity, length, and examples
"""
def __init__(self, max_complexity=1000, max_length=20,
item_c... | /random-regex-0.0.5.tar.gz/random-regex-0.0.5/random_regex/generator/generator.py | 0.719581 | 0.38004 | generator.py | pypi |
import math
import json
import requests
import gpxpy
from . import coordinate
class Route:
"""Class for interacting with the OpenRouteService API and handling the response."""
def __init__(self, points):
self.points = points
self.routing_points = []
self.routing = {}
def sort... | /random-route-generator-1.0.3.tar.gz/random-route-generator-1.0.3/src/randomRouteGenerator/route.py | 0.783823 | 0.33719 | route.py | pypi |
from . import coordinate
from . import route
class RouteGenerator:
""" Class to generate a random route """
class ROUTE_MODE:
""" Enum for the route mode (handling the origin point in the route) """
EXCLUDE_ORIGIN = 0 # Don't include the origin point from the route
START_ORIGIN = 1 # ... | /random-route-generator-1.0.3.tar.gz/random-route-generator-1.0.3/src/randomRouteGenerator/route_generator.py | 0.644225 | 0.328529 | route_generator.py | pypi |
import math
import requests
import json
import random
import haversine
import math
import overpy
class Coordinate:
"""A class to represent a coordinate."""
def __init__(self, lat, lon):
self.lat = lat
self.lon = lon
#Data for API caching
self.__overpass_cache = {}
self... | /random-route-generator-1.0.3.tar.gz/random-route-generator-1.0.3/src/randomRouteGenerator/coordinate.py | 0.833087 | 0.374305 | coordinate.py | pypi |
import numpy as np
from pysubgroup import ps
from pysubgroup.subgroup_description import Conjunction
def encode_subgroup(decoded_subgroup):
conjunction = []
for attribute_name, cond in decoded_subgroup['conditions'].items():
selector_type = cond['selector_type']
if selector_type == 'Interval... | /random_subgroups-0.4.1-py3-none-any.whl/randomsubgroups/subgroup.py | 0.808597 | 0.304985 | subgroup.py | pypi |
from lifelines.statistics import logrank_test
import numpy as np
def _find_split(node):
"""
Find the best split for a Node.
:param node: Node to find best split for.
:return: score of best split, value of best split, variable to split, left indices, right indices.
"""
score_opt = 0
split_... | /random_survival_forest-0.8.1-py3-none-any.whl/random_survival_forest/splitting.py | 0.818047 | 0.475971 | splitting.py | pypi |
from itertools import combinations
def concordance_index(y_time, y_pred, y_event):
"""
Compute concordance index.
:param y_time: Actual Survival Times.
:param y_pred: Predicted cumulative hazard functions.
:param y_event: Actual Survival Events.
:return: c-index.
"""
predicted_outcome ... | /random_survival_forest-0.8.1-py3-none-any.whl/random_survival_forest/scoring.py | 0.5794 | 0.506774 | scoring.py | pypi |
import multiprocessing
from joblib import Parallel, delayed
import numpy as np
import pandas as pd
from lifelines import NelsonAalenFitter
from sklearn.utils import check_random_state
from random_survival_forest.scoring import concordance_index
from random_survival_forest.splitting import _find_split
class RandomSu... | /random_survival_forest-0.8.1-py3-none-any.whl/random_survival_forest/models.py | 0.782081 | 0.507995 | models.py | pypi |
from randomText.src.base_faker import Faker
import pandas as pd
class RandomObject9(Faker):
def __init__(self):
super().__init__()
def get_addresses(self, size=1, country='en_US'):
"""
Get a random of objects
:param size: number of addresses to return
:param country: c... | /random-text-1.8.0.tar.gz/random-text-1.8.0/randomText/src/faker_endpoints.py | 0.820649 | 0.32822 | faker_endpoints.py | pypi |
import hashlib
import math
import time
from base64 import b64encode, b64decode
from Cryptodome.Cipher import AES
from Cryptodome.Util.Padding import pad, unpad
class RandomEncrypt:
# 北京时间时区信息
_timezoneOffset = 8
# key有效期(单位秒)
_timeInterval = 5
# 加密key长度
_keyLength = 16
# 如果跨区间 冗余几秒
... | /random_tool-1.0.2-py3-none-any.whl/random_encrypt/RandomEncrypt.py | 0.448909 | 0.221309 | RandomEncrypt.py | pypi |
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json
from typing import List
from collections import namedtuple
VocalinkModulusAlgorithmType = namedtuple('VocalinkAlgorithmType', ['name', 'modulus'])
class VocalinkModulusAlgorithms:
DBLAL = VocalinkModulusAlgorithmType('DBLAL', 10... | /random_uk_bank_account-0.0.4-py3-none-any.whl/random_uk_bank_account/vocalink/vocalink_model.py | 0.830525 | 0.437763 | vocalink_model.py | pypi |
from random_uk_bank_account.vocalink.vocalink_model import VocalinkRule, VocalinkModulusAlgorithms
class ConditionalVocalinkCheckLogic:
def __init__(
self,
sort_code_array,
sort_code_sum,
account_number_array,
account_number_sum,
rule: Vocal... | /random_uk_bank_account-0.0.4-py3-none-any.whl/random_uk_bank_account/validator/vocalink_check_logic.py | 0.57332 | 0.456834 | vocalink_check_logic.py | pypi |
from random_uk_bank_account.vocalink.vocalink_model import \
(VocalinkRuleCollection, VocalinkRule, VocalinkModulusAlgorithms, VocalinkModulusAlgorithmType,
VocalinkSortCodeSubstitution)
from random_uk_bank_account.validator.vocalink_check_logic import ConditionalVocalinkCheckLogic
class ModulusChecker:
... | /random_uk_bank_account-0.0.4-py3-none-any.whl/random_uk_bank_account/validator/modulus_checker.py | 0.675229 | 0.39257 | modulus_checker.py | pypi |
from typing import List
from dataclasses_json import dataclass_json
from random_uk_bank_account.utils.random import get_random_number_array
from random_uk_bank_account.validator.modulus_checker import ModulusChecker
from random_uk_bank_account.vocalink.vocalink import \
(get_vocalink_rules_for_sort_code, get_voca... | /random_uk_bank_account-0.0.4-py3-none-any.whl/random_uk_bank_account/generator/uk_account.py | 0.662469 | 0.206434 | uk_account.py | pypi |
http_codes = {
# Informational.
100: ('continue',),
101: ('switching_protocols',),
102: ('processing',),
103: ('checkpoint',),
122: ('uri_too_long', 'request_uri_too_long'),
200: ('ok', 'okay', 'all_ok', 'all_okay', 'all_good', '\\o/', '✓'),
201: ('created',),
202: ('accepted',),
... | /random_utilities-1.0.4.tar.gz/random_utilities-1.0.4/random_utilities/models/http_codes.py | 0.587943 | 0.166472 | http_codes.py | pypi |
from math import atan, sin, cos, radians, degrees
import numpy as np
class Vector:
"""
A vector class which has many useful vector methods.
"""
def __init__(self, x=0, y=0, z=0):
self.x, self.y, self.z = x, y, z
def get_rad(self):
"""
Only 2D
"""
return at... | /random_utils-1.0.0.tar.gz/random_utils-1.0.0/random_utils/math/vector.py | 0.932791 | 0.501526 | vector.py | pypi |
class Queue:
def __init__(self, *args):
self.arr = list(args)
def size(self):
return len(self)
def empty(self):
return len(self) == 0
def push(self, element):
self.arr.append(element)
def put(self, element):
self.push(element)
def append(self, elemen... | /random_utils-1.0.0.tar.gz/random_utils-1.0.0/random_utils/datatypes/queue.py | 0.453504 | 0.261254 | queue.py | pypi |
import pygame
from colorsys import rgb_to_hsv, hsv_to_rgb
import numpy as np
import os
class ColorPicker:
def __init__(self, wheel_pos, wheel_rad, slider_pos, slider_size, slider_horiz, slider_invert, cursor_rad, display_rect_loc, display_rect_size=(150, 150)):
self.wheel_pos, self.wheel_rad = wheel_pos, ... | /random_utils-1.0.0.tar.gz/random_utils-1.0.0/random_utils/pygame/__init__.py | 0.447219 | 0.366731 | __init__.py | pypi |
import math
import matplotlib.pyplot as plt
from .Generaldistribution import Distribution
class Gaussian(Distribution):
""" Gaussian distribution class for calculating and
visualizing a Gaussian distribution.
Attributes:
mean (float) representing the mean value of the distribution
stdev (float) representing ... | /random_var_distro-0.1.tar.gz/random_var_distro-0.1/random_var_distro/Gaussiandistribution.py | 0.688364 | 0.853058 | Gaussiandistribution.py | pypi |
from __future__ import print_function
import math
class RandomVariable(object):
def __init__(self, S, p=None, func=None):
self.S = S
self.p = p or (lambda x, S=S: 1.0/len(S))
self.func = func or (lambda x: x)
def __call__(self, x):
return self.func(x)
def apply(self, g):
... | /random_variable-0.2.tar.gz/random_variable-0.2/random_variable.py | 0.585575 | 0.203906 | random_variable.py | pypi |
from random import Random, SystemRandom, BPF as _BPF, RECIP_BPF as _RECIP_BPF
from functools import reduce as _reduce
from operator import xor as _xor
from hashlib import sha256 as _sha256
class CompoundRandom(SystemRandom):
def __new__(cls, *sources):
"""Create an instance.
Positional arguments mu... | /random_xe-1.0.0.tar.gz/random_xe-1.0.0/random_xe.py | 0.733833 | 0.197599 | random_xe.py | pypi |
import copy
import math
import torch
from torch import nn
class PositionalEncoding(nn.Module):
def __init__(self, d_model: int, dropout: float = 0.1, max_len: int = 5000):
super(PositionalEncoding, self).__init__()
position = torch.arange(max_len).unsqueeze(1)
div_term = torch.exp(
... | /randomattempt-0.0.3.tar.gz/randomattempt-0.0.3/interaction_aware_motion_prediction/predictor.py | 0.933567 | 0.394872 | predictor.py | pypi |
import bisect
import math
import numpy as np
class CubicSpline1D:
"""
1D Cubic Spline class
Parameters
----------
x : list
x coordinates for data points. This x coordinates must be
sorted
in ascending order.
y : list
y coordinates for data points
"""
d... | /randomattempt-0.0.3.tar.gz/randomattempt-0.0.3/interaction_aware_motion_prediction/planner_utils.py | 0.893237 | 0.583797 | planner_utils.py | pypi |
import math
from collections import defaultdict
import matplotlib.pyplot as plt
import numpy as np
from smarts.core.utils.math import position_to_ego_frame, wrap_value
class observation_adapter(object):
def __init__(self, num_neighbors=5):
self.num_neighbors = num_neighbors
self.hist_steps = 11
... | /randomattempt-0.0.3.tar.gz/randomattempt-0.0.3/interaction_aware_motion_prediction/observation.py | 0.617974 | 0.581838 | observation.py | pypi |
import matplotlib.pyplot as plt
import numpy as np
import torch
from smarts.core.road_map import Waypoint
from smarts.core.utils.math import (
_gen_ego_frame_matrix,
constrain_angle,
radians_to_vec,
signed_dist_to_line,
)
from .planner_utils import *
class Planner(object):
def __init__(self, pre... | /randomattempt-0.0.3.tar.gz/randomattempt-0.0.3/interaction_aware_motion_prediction/planner.py | 0.673192 | 0.454472 | planner.py | pypi |
# Do not remove the following comment; it is used by
# astropy_helpers.version_helpers to determine the beginning of the code in
# this module
# BEGIN
import locale
import os
import subprocess
import warnings
def _decode_stdio(stream):
try:
stdio_encoding = locale.getdefaultlocale()[1] or 'utf-8'
ex... | /randomfield-0.1.tar.gz/randomfield-0.1/astropy_helpers/astropy_helpers/git_helpers.py | 0.554229 | 0.156298 | git_helpers.py | pypi |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.