Saravanan666/pypi-org huggingface dataset:
Package: metrics_layer
Metrics LayerWhat is a Metrics Layer?Metrics Layer is an open source project with the goal of making access to metrics consistent throughout an organization. We believe you should be able to access consistent metrics from any tool you use to access data. This metrics layer is designed to work withZenlyticas a BI tool.How does it work?Zenlyticis the only supported BI tool. The Metrics Layer will read your data model and give you the ability to access those metrics and dimensions in a python client library, or through SQL with a specialMQLtag.Sound interesting? Here's how to set Metrics Layer up with your data model and start querying your metrics inin under 2 minutes.InstallationMake sure that your data warehouse is one of the supported types. Metrics Layer currently supports Snowflake, BigQuery, Postgres, Druid (only SQL compilation, not running the query), DuckDB (only SQL compilation, not running the query), SQL Server (only SQL compilation, not running the query), and Redshift, and only works withpython >= 3.8up topython < 3.11.Install Metrics Layer with the appropriate extra for your warehouseFor Snowflake runpip install metrics-layer[snowflake]For BigQuery runpip install metrics-layer[bigquery]For Redshift runpip install metrics-layer[redshift]For Postgres runpip install metrics-layer[postgres]Profile set upThere are several ways to set up a profile, we're going to look at the fastest one here.The fastest way to get connected is to pass the necessary information directly into Metrics Layer. Once you've installed the library with the warehouse you need, you should be able to run the code snippet below and start querying.You'll pull the repo from Github for this example. For more detail on getting set up, check out thedocumentation!from metrics_layer import MetricsLayerConnection

# Give metrics_layer the info to connect to your data model and warehouse
config = {
  "location": "https://myusername:myaccesstoken@github.com/myorg/myrepo.git",
  "branch": "develop",
  "connections": [
    {
      "name": "mycompany",              # The name of the connection in your data model (you'll see this in model files)
      "type": "snowflake",
      "account": "2e12ewdq.us-east-1",
      "username": "demo_user",
      "password": "q23e13erfwefqw",
      "database": "ANALYTICS",
      "schema": "DEV",                  # Optional
    }
  ],
}
conn = MetricsLayerConnection(**config)

# You're off to the races. Query away!
df = conn.query(metrics=["total_revenue"], dimensions=["channel", "region"])For more advanced methods of connection and more information about the project check outthe docs.
Package: metricslib
Metricslib is a package that can be used to send application metrics to metric
collections services.Supported metric collection servicesstatsdInstallationMetricslib requires python >= 3.5. Install the latest version using pippipinstallmetricslibUsageMetricslib provides a decorator that can be used on a function where we want to
collect metrics about how many times it was called, how many times it executed
successfully, how many times it was executed with errors and how long it took
to run.For the moment the only supported metric collection service is Statsd.frommetricslib.utilsimportconfigure_metrics_from_dictfrommetricslib.decoratorsimportcapture_metrics@capture_metrics(request_metric="myapp.do_something.request",error_metric="myapp.do_something.error",success_metric="myapp.do_something.success",execution_time_metric="myapp.do_something.execution")defdo_something():print("hello world")@capture_metrics(request_metric="myapp.do_something.request",error_metric="myapp.do_something.error",success_metric="myapp.do_something.success",execution_time_metric="myapp.do_something.execution")defdo_something_bad():raiseException()defmain():config={"STATSD_HOST":"localhost","STATSD_PORT":8125}configure_metrics_from_dict(config)do_something()# we want this function to raise an exception in order to test the error# metricdo_something_bad()if__name__=="__main__":main()Instead of using the decorator you can create counter objects.frommetricslib.configimportconfigure_metrics_from_dictfrommetricslib.utilsimportget_metricsdefmain():config={"STATSD_HOST":"localhost","STATSD_PORT":8125}configure_metrics_from_dict(config)metrics=get_metrics()counter=metrics.counter("myapp.count")counter.incr()if__name__=="__main__":main()You can also measure the time duration of an operation.fromtimeimportsleepfrommetricslib.configimportconfigure_metrics_from_dictfrommetricslib.utilsimportget_metricsdefmain():config={"STATSD_HOST":"localhost","STATSD_PORT":8125}configure_metrics_from_dict(config)metrics=get_metrics()duration=metrics.duration("myapp.time")duration_measurement=duration.begin()sleep(2.0)duration_measurement.end()if__name__=="__main__":main()
Package: metrics-logger
STScI Metrics LoggerThe metrics logger is a simple decorator intended to provide standardized logging for annotated pytest methods with tags to identify associated build requirements. As this is a generic utility, any method can be decorated and any type of tagging can be provided.Log messages will follow a format that will provide:METRIC - A static tag that will mark the beginning of the message.Tags - A comma delimited list of the provided tags to the decorator.Method - The decorated method name.Result - FAIL if the method raises an exception and PASS otherwise.The above will be delimited with a spaced hyphen:-NoteHyphens in the provided tags are supported.InstallationThe metrics_logger utility is not currently available in PyPi. To include it in a Conda environment, you can refer to it directly in your conda environment file in the pip section as follows:dependencies:
  - pip
  - pip:
    metrics_logger https://github.com/spacetelescope/romancal.gitDevelopmentmetrics_logger development can be done with Conda.Create and activate the environment$ conda env create --file conda-env.yml
$ conda activate metrics-loggerUpdate the requirements$ conda activate metrics-logger
$ conda env update --file conda-env.ymlUsageImport the metrics_logger utility and insert it above the method to be annotated providing a list of tags as arguments. Each time the method is invoked, it will result in a log line being emitted to a logger named "metrics_logger".Example:frommetrics_logger.decoratorsimportmetrics_logger@metrics_logger('DMS86','DMS-129')deftest_some_functional_thing():assertTrueWill result in the following log line (depending on log format):2023-06-14 16:09:28,947 - stpipe - INFO - DMS86, DMS129 - test_some_functional_thing - PASSSimilarly:@metrics_logger('DMS86','DMS-129')deftest_some_functional_thing():raiseException("Oops!")Will result in:2023-06-14 16:10:09,221 - stpipe - INFO - DMS86, DMS129 - test_some_functional_thing - FAIL
Package: metricsoperator
Metrics Operator PythonHelpers for submitting CRD with Python and parsing logs.Welcome to the Metrics Operator Python! You can learn more about the operator
at the  ⭐️Documentation⭐️
and see ourpython examplesfor examples of using this module.LicenseHPCIC DevTools is distributed under the terms of the MIT license.
All new contributions must be made under this license.SeeLICENSE,COPYRIGHT, andNOTICEfor details.SPDX-License-Identifier: (MIT)LLNL-CODE- 842614
Package: metrics.pylint
installationto install:$pipinstallmetrics.pylintto uninstall:$pipuninstallmetrics.pylintfor details please see the documentation of metrics.metrics.pylintThematrics.gitinfopackage is a plugin for the metrics package.metrics.pylint adds a pylint_score to file metrics for all python files:"tests/test_sloc_python.py":{"comments":8,"language":"Python","mccabe":0,"positions":[],"pylint_score":6.67,"ratio_comment_to_code":0.24,"sloc":33}Acknowledgementsalecxe for a recipe on how to use pylint programmatically and how to
extract the pylint score:https://stackoverflow.com/questions/39453828/extracting-pylint-scoreLicenseCopyright (c) 2018 Mark Fink and others. metrics is released under the
MIT License (see MIT_LICENSE).
Package: metrics.pytest-cov
installationto install:$pipinstallmetrics.pytest-covto uninstall:$pipuninstallmetrics.pytest-covfor details please see the documentation of metrics.metrics.pytest-covThemetrics.pytest-covpackage is a plugin for the metrics package.Basically what this plugin does is it extract the data you get from
running “$ coverage report -m” on the command line.We assume that you run your pytest tests (incl. pytest-cov) before your
run metrics. In case your test execution fails you should fix your code
and rerun the tests prior to running metrics with this plugin.The metrics.pytest-cov plugin picks up the .coverage file from your
successful test run. If you must know, we could run the tests but
decided not to.Please note that in case a .coverage file from a testrun is not
available we silently do nothing.AcknowledgementsCarsten for a recipe on how to load the .coverage file programmaticallyhttps://stackoverflow.com/questions/35224643/how-do-i-access-coverage-py-results-programmaticallyLicenseCopyright (c) 2018 Mark Fink and others. metrics is released under the
MIT License (see MIT_LICENSE).
Package: metricsreport
Metrics ReportMetricsReport is a Python package that generates classification and regression metrics report for machine learning models.FeaturesAutoDetect the type of taskSave report in .html and .md formatHas several plotting functionsInstallationYou can install MetricsReport using pip:pipinstallmetricsreportUsagefrommetricsreportimportMetricsReport# sample classification datay_true=[1,0,0,1,0,1,0,1]y_pred=[0.8,0.3,0.1,0.9,0.4,0.7,0.2,0.6]# generate reportreport=MetricsReport(y_true,y_pred,threshold=0.5)# print all metricsprint(report.metrics)# plot ROC curvereport.plot_roc_curve()# saved MetricsReport (html and .md) in folder: report_metricsreport.save_report()More examples in the folder ./examples:ConstructorMetricsReport(y_true,y_pred,threshold:float=0.5)y_true: listA list of true target values.y_pred: listA list of predicted target values.threshold: floatThreshold for generating binary classification metrics. Default is 0.5.Plotsfollowing methods can be used to generate plots:plot_roc_curve(): Generates a ROC curve plot.plot_precision_recall_curve(): Generates a precision-recall curve plot.plot_confusion_matrix(): Generates a confusion matrix plot.plot_class_distribution(): Generates a class distribution plot.plot_calibration_curve(): Generates a calibration curve plot.plot_lift_curve(): Generates a lift curve plot.plot_cumulative_gain(): Generates a cumulative gain curve plot.Dependenciesnumpypandasmatplotlibscikit-learnscikit-plotLicenseThis project is licensed under the MIT License.
Package: metrics-tools
metrics_toolsA simple python package for making API calls to metrics.tools API.https://metrics.tools/It builds upon the requests package. The goal is to achiev an easy syntax for the API calls like:mt.domain('example.com').rankings.get()Note: I am not professional programmer. Install at your own risk. Useful tips are welcome :-).Install via pippipinstallmetrics-toolsBasic usagefrommetrics_toolsimportMetricsToolsapi_key='your api key'mt=MetricsTools(api_key,verbose=True)domain=mt.domain('example.com')visibility=domain.sk.get()rankings=domain.rankings.get()keyword_details=mt.keyword('api').details.get()ResponseThe response is parsed into a simple object with fields as object attributes. Additionaly it contains the requests response as '._response'.example_domain.values# if values are presentexample_domain.json# parsed json responseexample_domain.result# 'success' or 'error'More ParametersThe API supports some additional parameters, respectifly filters, to narrow down the API answer. These filters can be used through the avalible functions.#Visibility for specific datedomain.sk.from_('2018-05-07').get()#Min and max visibility valuedomain.sk.minmax().get()#Ranking position for domain and given keyworddomain.position.for_keyword('jens fauldrath').get()API callsThe minimum interval for calls is 0.2 sec.
Package: metric-time
metric-timeImplementation of decimal time and French Republican calendar.During the French Revolution, attempts were made decimalise various measuring methods including time and calendars. Two things arose from this movement: The french Republican calendar and Decimal calendar.French Republic calendarTheFrench Republic calendarcalendar consists of 12 months, each with exactly 30 days. Each week (décade) had 10 days. Years are counted in relation to the year 1792. The year usually begins on the 22nd of September. The calendar was introduced in 1793 and abolished in 1805Decimal timeAdecimal clockconsists of 10 hours, each containing 100 minutes with 100 seconds. This means that the definition of the second has to be changed to 1 decimal second = 0.864 normal seconds. It was introduced in 1794 and suspended in 1795.InstallationPip$pipinstallmetric-timeGit clone$gitclonehttps://github.com/lakhanmankani/metric-time.gitUsage$metric-time$python3metric_time.pyor as a Python API>>>importmetric_time>>>importdatetime>>>importpytz.reference>>>decimal_time=metric_time.DecimalTime()>>>decimal_time.now()"08:02:88.543"# Time in format hours:minutes:seconds.milliseconds>>>republican_calendar=metric_time.RepublicanCalendar()>>>republican_calendar.now()"Décadi 10 Messidor 226"# Date in format day date month yearConvert from normal date time to metric>>>decimal_time.decimal_time(datetime.datetime(year=2018,month=6,day=28,hour=13,minute=50,second=30))"05:76:73.611"# Time in format hours:minutes:seconds.milliseconds>>>republican_calendar.republican_date(datetime.datetime(year=2020,month=5,day=20,tzinfo=pytz.reference.LocalTimezone()))"Duodi 2 Prairial 228"# Date in format day date month yearAccess time components>>>now_time=decimal_time.now()>>>now_time.hours8>>>now_time.minutes2>>>now_time.seconds88>>>now_time.milliseconds543Access date components>>>now_date=republican_calendar.now()>>>now_date.year226.91780821917808>>>now_date.month"Prairial">>>now_date.day10>>>now_date.day_of_the_week"Décadi"
Package: metriculous
metriculousMeasure, visualize, and compare machine learning model performance without the usual boilerplate.
Breaking API improvements to be expected.Installation$pipinstallmetriculousOr, for the latest unreleased version:$pipinstallgit+https://github.com/metriculous-ml/metriculous.gitComparing Regression ModelsClick to see more codeimportnumpyasnp# Mock the ground truth, a one-dimensional array of floatsground_truth=np.random.random(300)# Mock the output of a few modelsperfect_model=ground_truthnoisy_model=ground_truth+0.1*np.random.randn(*ground_truth.shape)random_model=np.random.randn(*ground_truth.shape)zero_model=np.zeros_like(ground_truth)importmetriculousmetriculous.compare_regressors(ground_truth=ground_truth,model_predictions=[perfect_model,noisy_model,random_model,zero_model],model_names=["Perfect Model","Noisy Model","Random Model","Zero Model"],).save_html("comparison.html").display()This will save an HTML file with common regression metrics and charts, and if you are working in aJupyter notebookwill display the output right in front of you:Comparing Classification ModelsClick to see more codeimportnumpyasnpdefnormalize(array2d:np.ndarray)->np.ndarray:returnarray2d/array2d.sum(axis=1,keepdims=True)class_names=["Cat","Dog","Pig"]num_classes=len(class_names)num_samples=500# Mock ground truthground_truth=np.random.choice(range(num_classes),size=num_samples,p=[0.5,0.4,0.1])# Mock model predictionsperfect_model=np.eye(num_classes)[ground_truth]noisy_model=normalize(perfect_model+2*np.random.random((num_samples,num_classes)))random_model=normalize(np.random.random((num_samples,num_classes)))importmetriculousmetriculous.compare_classifiers(ground_truth=ground_truth,model_predictions=[perfect_model,noisy_model,random_model],model_names=["Perfect Model","Noisy Model","Random Model"],class_names=class_names,one_vs_all_figures=True,).display()DevelopmentPoetryThis project usespoetryto manage
dependencies. Please make sure it is installed for the required python version. Then install the dependencies withpoetry install.MakefileA Makefile is used to automate common development workflows. Typemakeormake helpto see a list of available commands. Before commiting changes it is recommended to runmake format check test.
Package: metric-vis
# MetricVishttps://www.holistics.io/blog/how-amazon-measures/## Installing` pip installmetric-vis`## Quickstart` python from MetricVis import plot_week_month_trend import pandas as pd monthly_df =pd.read_csv('demo_data/monthly_data.csv')monthly_df.index = pd.to_datetime(monthly_df.Day) weekly_df =pd.read_csv('demo_data/weekly_data.csv')weekly_df.index = pd.to_datetime(weekly_df.Day) plot_week_month_trend(weekly_df = weekly_df, monthly_df = monthly_df, col_name = "Metric", month_lookback = 11) `<img alt=”Weekly/Monthly Trend” src=”images/weekly_monthly_trend.png”>` python from MetricVis import plot_actual_forecast import pandas as pd forecast_df =pd.read_csv('demo_data/forecast_data.csv')forecast_df.index = pd.to_datetime(forecast_df.Day) plot_actual_forecast(df = forecast_df, actual_col = "Metric", forecast_col = "Forecast", lookback = 8) `<img alt=”Actual vs Forecast” src=”images/actual_vs_forecast.png”>
Package: metricx
MetricXA library for managing, exploring, and analyzing benchmark data. Given a set of tasks
and a set of models which can be evaluated on the tasks,MetricXprovides a suite
of features including:Monitoring and logging of modeling results.Export to CSV, matplotlib, bokeh, and more!Smart selection of the next model to evaluate.Interactive visualization in Jupyter notebooks.Interactive HTML reports (deployable via Github Pages).Quick StartInstall MetricXYou can install the latest stable releasepipinstallmetricxOr you can install the development headpipinstallgit+https://github.com/k15z/MetricX.gitDefine your taskFirst, you'll want to define your task(s). Every task has a name and a
set of metrics.frommetricximportMetric,Tasktask=Task(name="mnist-digits",metrics=[Metric(name="accuracy",is_higher_better=True),Metric(name="fit-time",is_higher_better=False),Metric(name="predict-time",is_higher_better=False),],)Report your resultsThen, you can report your results by providing (1) the name of the model
being evaluated and (2) a results dictionary containing a value for each of
the metrics specified earlier.task.report("convnet",{"accuracy":1.0,"fit-time":100.0,"predict-time":3.0,})task.report("logistic-regression",{"accuracy":0.6,"fit-time":10.0,"predict-time":1.0,})Generate plots and rankingsTheTaskobject provides numerous functionality from generating plots
to ranking models.task.to_bokeh()# generate a Bokeh plottask.to_figure()# generate a matplotlib Figuretask.rank()# return a ranking of modelsCombine multiple tasksIf you have multiple tasks, as is typical in a benchmarking scenario, you
can use theTaskGridto wrap them together and generated combined
visualizations and more.frommetricximportTaskGridgrid=TaskGrid([task])grid.to_html("benchmark.html")This will create a standalone HTML file which allows you to interactively
explore the benchmark results.
Package: metricz
MetriczMetricz makes it easy to write metrics to a Kairosdb instance running with OAuth2 security.FeaturesOAuth2 support.Option to batch write metrics at a later time.UsageTo simply write a metric:frommetriczimportMetricWritermw=MetricWriter(directory='/path/to/credentials/dir)mw.write_metric('some.metric.name',123,{'some':'tag'})To write a metric with a custom timestamp:importdatetime# Make sure this is in UTC.timestamp=datetime.datetime(1981,10,26,6,24)mw.write_metric('some.metric.name',34,{'some':'tag'},timestamp)To batch write metrics:# These are NOT written directly.mw.defer_metric('some.metric.name',42,{'some':'tag'})mw.defer_metric('some.other.metric.name',64,{'some':'tag'})mw.defer_metric('some.other.metric.name',64,{'some':'tag'})# Write all deferred metrics at once.mw.write_deferred()TODORetry on failure.Look at non-blocking options to write.History0.1.0 (2016-08-03)First release on PyPI.
Package: metrika
Metrika is a library to run and measure benchmarks with
scientific rigor. By automating the process of benchmark
running, scientists can avoid common mistakes. Metrika
allows to obtain statistically solid measures without
accidentally introducing methodological errors. In order
to do that, the library executes the benchmarks many times
and presents results taking into account things like expected
value, standard deviation, etc.This version requires Python 3 or later
Package: metriks
metriks is a Python package of commonly used metrics for evaluating information retrieval models.Available MetricsPython APIDescriptionmetriks.recall_at_k(y_true, y_prob, k)Calculates recall at k for binary classification ranking problems.metriks.precision_at_k(y_true, y_prob, k)Calculates precision at k for binary classification ranking problems.metriks.mean_reciprocal_rank(y_true, y_prob)Gets a positional score on how well you did at rank 1, rank 2, etc.metriks.ndcg(y_true, y_prob, k)A score for measuring the quality of a set of ranked results.label_mean_reciprocal_rank(y_true, y_prob)Determines the average rank each label was placed across samples. Only labels
that are relevant in the true data set are considered in the calculation.metriks.confusion_matrix_at_k(y_true, y_prob, k)Generates binary predictions from probabilities by evaluating the top k
items (in ranked order by y_prob) as true.InstallationInstall usingpippip install metriksAlternatively, specific distributions can be downloaded from the
githubreleasepage. Once downloaded, install the.tar.gzfile directly:pip install metriks-\*.tar.gzDevelopment1. (Optional) If you havevirtualenvandvirtualenvwrappercreate a new virtual environment:mkvirtualenv metriksThis isolates your specific project dependencies to avoid conflicts
with other projects.2. Clone and install the repository:git clone git@github.com:intuit/metriks.git
cd metriks
pip install -e .This will install a version to an isolated environment in editable
mode. As you update the code in the repository, the new code will
immediately be available to run within the environment (without the
need topip installit again)3. Run the tests usingtox:pip install tox
toxTox will run all of the tests in isolated environments
Package: metriql-lookml
metriql Looker IntegrationGenerates LookML model from your metriql datasets.
The idea is to leverage metriql datasets in your Looker setup without any additional modeling.UsageThe library is available in PyPI so you can install it via pip as follows:pip install metriql-lookmlThe library expectsstdinfor the metriql metadata and outputs a ZIP file tostdout. Here is an example:curl http://metriql-server.com/api/v0/metadata | metriql-lookml --connection myproject > metriql.zipYou can use--fileargument instead of reading the metadata fromstdinas an alternative.The command outputs a zip file tostdoutby default, if you pass--out myfile.zipargument, it will write to the specified file instead.How does it work?Create a connection to metriql from Looker using itsTrino interface.Runmetriql-lookmlpassing the relevantconnectionargument for metriql.You need to enable JDBC in your metriql server to be able to use metriql's Trino interface.Build from sourceRequirespipenvand python >=3.7# From root folder
# Install
pipenv install --dev

# Run
pipenv run metriql2lookml