text:
# Introduction

Thank you for considering contributing to Wafer.

Wafer is an open source project and we love to receive contributions from our community — you! There are many ways to contribute, from improving the documentation, submitting bug reports and feature requests or writing code which can be incorporated into Wafer itself.
As Wafer is still pre 0.1, there are no channels other than the issue tracker setup for communication. If you have a support question, please file an issue with the tracker.
This may change as Wafer grows.

# Responsibilities

* Create issues for any major changes and enhancements that you wish to make. Discuss things transparently and get community feedback.
* Keep feature versions as small as possible, preferably one new feature per version.
* Be welcoming to newcomers and encourage diverse new contributors from all backgrounds. See our [Code of Conduct](CODE_OF_CONDUCT.md) and the [Rust Community Code of Conduct](https://www.rust-lang.org/en-US/conduct.html).

# Your First Contribution

Unsure where to begin contributing to Wafer? You can start by looking through the tracker and assign yourself to any issue that currently do not have an assignee.
Issues labeled Help wanted in particular.

Working on your first Pull Request? You can learn how from this *free* series, [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github).
If a maintainer asks you to "rebase" your PR, they're saying that a lot of code has changed, and that you need to update your branch so it's easier to merge.

# How to report a bug

If you find a security vulnerability, do NOT open an issue. Email tim@neophilus.net instead.

----

When filing an issue, make sure to answer/consider these five questions:

1. Have you updated to the latest rust nightly?
2. What operating system and processor architecture are you using?
3. What did you do?
4. What did you expect to see?
5. What did you see instead?

# How to suggest a feature or enhancement

Wafer aims to be fast and easy to operate. The feature list for v0.1 has already been roadmapped and will not change before that time.
With that being said, if you find yourself wishing for a feature that doesn't exist in Wafer, you are probably not alone.
There are bound to be others out there with similar needs. Many of the features that Wafer has today have been added because our users saw the need.
Open an issue on our issues list on GitHub which describes the feature you would like to see, why you need it, and how it should work.
The community will decide on its adoption and how to best implement it.

# Code review process

For the moment, Libbum will review your PR's whenever there is available time. Feel free to give him a prod if needed.

repository: Libbum/Wafer

gha_language: Rust

repo_name: Libbum/Wafer


text:
# Unit 19 React Homework: Employee Directory
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## Table of Contents
* [Introduction](#introduction)
* [Functionality](#functionality)
* [Tasks Completed](#tasks-completed)
* [Technologies Used](#technologies-used)
* [Installations](#installations)
* [Demo](#demo)
* [Future Ideas](#future-ideas)
* [Sources](#sources)
* [License](#license)

 ## Introduction
A manager can look up non-sensitive employee data that can be sorted and filtered.
* Deployed App: https://jxiong15.github.io/19-employee-directory/
* GitHub: https://github.com/JXIong15/19-employee-directory

## Functionality
* When the user loads the page, they are shown a chart of employees.
* User can sort employees in descending or ascending order based on any column.
* Using the search bar, user can filter employees to match the user's search input.

## Tasks Completed
* Dowloaded necessary NPM packages with `npm install` on the Command Line
* Created `src` and necessary folders for development
* Using Axios, pulled random users as employees from the https://randomuser.me/ api.
* In the `components` directory:
  * created a `Directory.js` with a React component.
    * Added necessary `state` variables.
    * created functions to fetch the API data, handle input change, and sort the array.
    * rendered data by passing `state props` and `functions` to other JS files
  * created a `Table.js` to display the employee data
    * all headings (`th`) except for the `picture` heading are clickable to be sorted.
    * in the `tableBody`, the passed in employee list gets mapped into individual employees. Each Employee's name, email, phone number, and address is pulled from the data.
  * created an `EmployeeDB` file to pass the `props` from the `Table.js` tableBody
    * returns data of each employee in the correct coulms to be displayed
* Added necessary scripts to the `package.json` file to deploy on GitHub Pages

Sorting "john" Example

## Technologies Used
* GitHub Pages
* React
* Props-States
* Axios

## Installations
* Axios
* React
* GH-Pages

## Demo
* App Demo:

## Future Ideas
* allow columns to sort by ascending first. An individual variable to account for each column ascending or descending.
* allow clicking on a row to take to an employee page

## Sources
* NPM Packages: https://www.npmjs.com/
* GitHub Pages: https://pages.github.com/
* Axios: https://www.axios.com/
* React: https://reactjs.org/

## License
Licensed under the [MIT License](LICENSE).

© 2021 Trilogy, Northwestern Coding Bootcamp

license: MIT

branch_name: refs/heads/main

extension: md

license_type: permissive


text:
(using_built_in_model_serving_classes)=
# Using built-in model serving classes

MLRun includes built-in classes for commonly used frameworks. While you can {ref}`create your own class <custom-model-serving-class>`, it is often not necessary to write one if you use these standard classes.

The following table specifies, for each framework, the relevant pre-integrated image and the corresponding MLRun `ModelServer` serving class:

|framework       |image          |serving class                               |
|:---------------|:--------------|:-------------------------------------------|
|Scikit-learn    |mlrun/mlrun    |mlrun.frameworks.sklearn.SklearnModelServer |
|TensorFlow.Keras|mlrun/ml-models|mlrun.frameworks.tf_keras.TFKerasModelServer|
|ONNX            |mlrun/ml-models|mlrun.frameworks.onnx.ONNXModelServer       |
|XGBoost         |mlrun/ml-models|mlrun.frameworks.xgboost.XGBoostModelServer |
|LightGBM        |mlrun/ml-models|mlrun.frameworks.lgbm.LGBMModelServer       |
|PyTorch         |mlrun/ml-models|mlrun.frameworks.pytorch.PyTorchModelServer |

For GPU support, use the `mlrun/mlrun-gpu` image (adding GPU drivers and support).

## Example

The following code shows how to create a basic serving model using Scikit-learn.

``` python
import os
import urllib.request
import mlrun

model_path = os.path.abspath('sklearn.pkl')

# Download the model file locally
urllib.request.urlretrieve(mlrun.get_sample_path('models/serving/sklearn.pkl'), model_path)

# Set the base project name
project_name_base = 'serving-test'

# Initialize the MLRun project object
project = mlrun.get_or_create_project(project_name_base, context="./", user_project=True)

serving_function_image = "mlrun/mlrun"
serving_model_class_name = "mlrun.frameworks.sklearn.SklearnModelServer"

# Create a serving function
serving_fn = mlrun.new_function("serving", project=project.name, kind="serving", image=serving_function_image)

# Add a model, the model key can be anything we choose. The class will be the built-in scikit-learn model server class
model_key = "scikit-learn"
serving_fn.add_model(key=model_key,
                    model_path=model_path,
                    class_name=serving_model_class_name)
```

After the serving function is created, you can test it:

``` python
# Test data to send
my_data = {"inputs":[[5.1, 3.5, 1.4, 0.2],[7.7, 3.8, 6.7, 2.2]]}

# Create a mock server in order to test the model
mock_server = serving_fn.to_mock_server()

# Test the serving function
mock_server.test(f"/v2/models/{model_key}/infer", body=my_data)
```

Similarly, you can deploy the serving function and test it with some data:

``` python
serving_fn.with_code(body=" ") # Workaround, required only for mlrun <= 1.0.2

# Deploy the serving function
serving_fn.apply(mlrun.auto_mount()).deploy()

# Check the result using the deployed serving function
serving_fn.invoke(path=f'/v2/models/{model_key}/infer',body=my_data)
```

repository: mlrun/mlrun

branch_name: refs/heads/development

gha_language: Python

repo_name: mlrun/mlrun


text:
---
layout: post
keywords: LeetCode, Math, Algorithm
description: Math Algorithm in LeetCode
title: "Math Algorithm in LeetCode"
categories: [Math]
tags: [Math, LeetCode]
group: archive
icon: file-alt
---
{% include site/setup %}

|Id  | Title  | Solution   | Time | Runtime |  Space | Difficulty  | Catagory|
 ------------ | ------------ | ------------ | ------------ | ------------ | ------------ | ------------ | ------------
|0018|[4Sum](https://leetcode.com/problems/4sum/) | [Java](https://e.srl/leetcode-18/)  | O(n\*n) |-| O(n\*n)  |  Medium |Math|
|0029|[Divide Two Integers](https://leetcode.com/problems/divide-two-integers/) | [Java](https://e.srl/leetcode-29/)  |-|-|-|  Medium |Math|
|0031|[Next Permutation](https://leetcode.com/problems/next-permutation) | [Java](https://e.srl/leetcode-31/)  |-|-|-|  Medium |Math|
|0043|[Multiply Strings](https://leetcode.com/problems/multiply-strings/) | [Java](https://e.srl/leetcode-43/)  ||||  Medium |Math|
|0047|[Permutations II](https://leetcode.com/problems/permutations-ii) | [Java](https://e.srl/leetcode-47/)  ||||  Medium |Math|
|0050|[Pow(x, n)](https://leetcode.com/problems/powx-n/) | [Java](https://e.srl/leetcode-50/)  | O(lgn) |99.47%| O(1)  |  Medium |Math|
|0060|[Permutation Sequence](https://leetcode.com/problems/permutation-sequence/) | [Java](https://e.srl/leetcode-60/)  |-|-|-|  Medium |Math|
|0065|[Valid Number](https://leetcode.com/problems/valid-number) | [Java](https://e.srl/leetcode-65/)  |-|-|-|  Hard |Math|
|0066|[Plus One](https://leetcode.com/problems/plus-one/) | [Java](https://e.srl/leetcode-66/)  |-|-|-|  Easy |Math|
|0067|[Add Binary](https://leetcode.com/problems/add-binary) | [Java](https://e.srl/leetcode-67/)  |-|-|-|  Easy |Math|
|0069|[Sqrt(x)](https://leetcode.com/problems/sqrtx) | [Java](https://e.srl/leetcode-69/)  |-|-|-|  Easy |Math|
|0077|[Combinations](https://leetcode.com/problems/combinations/) | [Java](https://e.srl/leetcode-77/)  |-|-|-|  Medium |Math|
|0168|[Excel Sheet Column Title](https://leetcode.com/problems/excel-sheet-column-title) | [Java](https://e.srl/leetcode-168/)  | O(lgn) |2MS| O(n)  |  Easy |Math|
|0171|[Excel Sheet Column Number](https://leetcode.com/problems/excel-sheet-column-number/) | [Java](https://e.srl/leetcode-171/)  | O(lgn) |0MS| O(n)  |  Easy |Math|
|0172|[Factorial Trailing Zeroes](https://leetcode.com/problems/factorial-trailing-zeroes/) | [Java](https://e.srl/leetcode-172/)  | O(lgn) |1MS| O(1)  |  Easy |Math|
|0179|[Largest Number](https://leetcode.com/problems/largest-number/) | [Java](https://e.srl/leetcode-179/)  | O(n\*n) |99.89%| O(n)  |  Medium |Math|
|0202|[Happy Number](https://leetcode.com/problems/happy-number/) | [Java](https://e.srl/leetcode-202/)  | - |5MS| O(1)  |  Easy |Math|
|0204|[Count Primes](https://leetcode.com/problems/count-primes/) | [Java](https://e.srl/leetcode-204/)  | - |22MS| O(n)  |  Easy |Math|
|0335|[Self Crossing](https://leetcode.com/problems/self-crossing) | [Java](https://e.srl/leetcode-335/)  | O(n) |0ms| O(1)  |  Hard |Math|
|0338|[Counting Bits](https://leetcode.com/problems/counting-bits/) | [Java](https://e.srl/leetcode-338/)  | O(n) |2ms| O(n)  |  Medium |Math|
|0454|[4Sum II](https://leetcode.com/problems/4sum-ii/) | [Java](https://e.srl/leetcode-454/)  | O(n\*n) |97.52%| O(n)  |  Medium |Math|
|0592|[Fraction Addition and Subtraction](https://leetcode.com/problems/fraction-addition-and-subtraction/)| [Java](https://e.srl/leetcode-592/)  | O(n) |16MS| O(n)  |  Medium |Math|
|0593|[Valid Square](https://leetcode.com/problems/valid-square)| [Java](https://e.srl/leetcode-593/)  | O(n) |20MS| O(1)  |  Medium |Math|
|0600|[Non-negative Integers without Consecutive Ones](https://leetcode.com/problems/non-negative-integers-without-consecutive-ones/) | [Java](https://e.srl/leetcode-600/)  | O(n) |-| O(n)  |  Hard |Math|

repository: anikahuo/algorithm

branch_name: refs/heads/master

gha_language: Java

gha_license_id: MIT

repo_name: anikahuo/algorithm


text:
Instructions

This flow components allows you to mimic the behavior of a Lookup field in a flow screen.

Input Attributes

Required Input Attributes

objectName (Object Name)

The object you want to show data from, for example Account

fieldName (Display Field)

The name of the field to show in the result list

iconName (Icon)

Referenced to an slds icon to use, see here for the full list:
https://www.lightningdesignsystem.com/icons/. An example is: action:add_contact

Optional Input Attributes

Label (Field Label)

The label to show with the field

required (Show required)

True/False, if the lookup field should be a required field or not. Default is false

LoadingText (Show Loading Indicator)

True/False, if the loading indicator should be show when fetching data. Default is false

Output Attributes

selectRecordId (Selected Id)

The id of the selected record

selectRecordName (Selected Record Name)

The value of the display field that was selected in the inputs for the selected record

repository: jdijk/FlowLocalAction

repo_name: jdijk/FlowLocalAction


text:
---
subcategory: "Unity Catalog"
---
# databricks_external_location Resource

To work with external tables, Unity Catalog introduces two new objects to access and work with external cloud storage:

- [databricks_storage_credential](storage_credential.md) represent authentication methods to access cloud storage (e.g. an IAM role for Amazon S3 or a service principal for Azure Storage). Storage credentials are access-controlled to determine which users can use the credential.
- `databricks_external_location` are objects that combine a cloud storage path with a Storage Credential that can be used to access the location.

## Example Usage

For AWS

```hcl
resource "databricks_storage_credential" "external" {
  name = aws_iam_role.external_data_access.name
  aws_iam_role {
    role_arn = aws_iam_role.external_data_access.arn
  }
  comment = "Managed by TF"
}

resource "databricks_external_location" "some" {
  name            = "external"
  url             = "s3://${aws_s3_bucket.external.id}/some"
  credential_name = databricks_storage_credential.external.id
  comment         = "Managed by TF"
}

resource "databricks_grants" "some" {
  external_location = databricks_external_location.some.id
  grant {
    principal  = "Data Engineers"
    privileges = ["CREATE_TABLE", "READ_FILES"]
  }
}
```

For Azure

```hcl
resource "databricks_storage_credential" "external" {
  name = azuread_application.ext_cred.display_name
  azure_service_principal {
    directory_id   = var.tenant_id
    application_id = azuread_application.ext_cred.application_id
    client_secret  = azuread_application_password.ext_cred.value
  }
  comment = "Managed by TF"
  depends_on = [
    databricks_metastore_assignment.this
  ]
}

resource "databricks_external_location" "some" {
  name = "external"
  url =<EMAIL_ADDRESS>    azurerm_storage_container.ext_storage.name,
  azurerm_storage_account.ext_storage.name)
  credential_name = databricks_storage_credential.external.id
  comment         = "Managed by TF"
  depends_on = [
    databricks_metastore_assignment.this
  ]
}

resource "databricks_grants" "some" {
  external_location = databricks_external_location.some.id
  grant {
    principal  = "Data Engineers"
    privileges = ["CREATE_TABLE", "READ_FILES"]
  }
}
```

For GCP

```hcl
resource "databricks_storage_credential" "ext" {
  name = "the-creds"
  databricks_gcp_service_account {}
}

resource "databricks_external_location" "some" {
  name = "the-ext-location"
  url  = "gs://${google_storage_bucket.ext_bucket.name}"

  credential_name = databricks_storage_credential.ext.id
  comment         = "Managed by TF"
}
```

## Argument Reference

The following arguments are required:

- `name` - Name of External Location, which must be unique within the [databricks_metastore](metastore.md). Change forces creation of a new resource.
- `url` - Path URL in cloud storage, of the form: `s3://[bucket-host]/[bucket-dir]` (AWS), `abfss://[user]@[host]/[path]` (Azure), `gs://[bucket-host]/[bucket-dir]` (GCP).
- `credential_name` - Name of the [databricks_storage_credential](storage_credential.md) to use with this External Location.
- `owner` - (Optional) Username/groupname/sp application_id of the external Location owner.
- `comment` - (Optional) User-supplied free-form text.
- `skip_validation` - (Optional) Suppress validation errors if any & force save the external location

## Import

This resource can be imported by name:

```bash
terraform import databricks_external_location.this <name>
```

repository: jxbell/terraform-provider-databricks

repo_name: jxbell/terraform-provider-databricks


text:
# Epic Meal Planner

Epic Meal Planner is a one-stop meal-planning application that lets users to search for recipes, save the ingredients to a grocery list, and add the meals to the calendar.

This was a 6-person project with over 1,000+ tracked hours.
The group was divided into 3 front-end developers, 2-back-end developers, and 1 project manager.

## [Live Demo](http://epicmealplanner.elainevphan.com/)
![readMeGif](./server/public/image/epic_meal_planner.gif)

## Getting Started

### Initial Setup

1. Fork this repo and clone your fork from the terminal.

```
https://github.com/[user_name]/epic_meal_planner.git
```

2. Navigate to, and open the `epicMealPlanner` directory, then install the necessary dependencies.

```
$ npm install
```

3. Start a dev environment with Apache2 and MySQL
   * Make sure that the port is directed to ```3000```

   * Create a database in phpMyAdmin and import the `MealPlan.sql` file

   * Create a new db_connections.php with your own credentials

4. Initiate the dev server

```
$ npm run dev
```

5. Go to `localhost:3000` and enjoy!

## Contributing

Please feel free to fork from this repository, make pull requests and help improve the project by sending suggestions to<EMAIL_ADDRESS>
## Built With

* JavaScript
* React
* Booststrap 4
* Reactstrap
* HTML5
* CSS3
* MySQL + phpMyAdmin
* PHP

## License
[MIT License](https://opensource.org/licenses/mit-license.php)

gha_language: TSQL


text:
Evaluation
==========

In this chapter, we present the results obtained from our approach.
Additionally, we compare the developed approach with state-of-the-art
strategies: evolutionary algorithms and static compound model-based
optimization.

Experimental setup
------------------

We will begin by introducing a description of the selected optimization
problems and applicable approaches for their analysis. Those problems
include ZDT, DTLZ and WFG problems suits.

### Optimization problems

Different optimization approaches need to applied to the numerous types
of optimization problems to reduce the comparison bias in the obtained
results (direct consequence of the No-free-Lunch theorem). To that mean, we select several
comprehensive synthetic benchmark suites for comparison. They are all
scalable in the parameter space and some are scalable in the objective
space. The problems are designed so that a meaningful comparison can be
obtained for optimization techniques. All cases are minimization
problems.

According to [@raw:WFGref], the following properties characterize the
optimization problems:

-   *Modality* is a property of the objective surface. Test problems are
    either unimodal, with one global optimum, or multimodal, with
    several local optima. Multimodal problems are more complicated than
    unimodal ones and bear more resemblance with real-world scenarios
    (Figure {@fig:intro_mult_bias}). Deceptive objective functions
    have a special kind of multimodality that has at least two optima —
    a true optimum and a deceptive optimum — but the majority of the
    search space favors the deceptive optimum [@raw:Deb99].

-   A *geometry* of the Pareto optimal front can be convex, linear,
    concave, mixed, degenerate, disconnected, or some combination of the
    former. It directly influences the algorithm’s performance.

-   A *bias* in landscape transformations impacts the search process by
    biasing the fitness landscape. Bias means that uniformly distributed
    parameters mapped onto a bias area in objective space. This type of
    problem can cause challenges if the bias region is far from the
    Pareto optimal front (Figure {@fig:intro_mult_bias}).

-   *Many-to-one* fitness mapping means that different parameter vectors
    can produce the same objective vector. This property makes the
    search more difficult to optimize because it leads to situation when
    most solutions produce the same result.

-   *Not separability* of the problem means that it can not be solved if
    consider it as a separate optimization problems for each objective.

![**(a)** Example of ZDT4 problem landscapes with multimodal (\#1) and unimodal objectives (\#2). **(b)** Example of bias landscape in WFG1 problem. Note how, in this example, the objective vectors are denser far away from Pareto optimal solutions.](images/utility/intro_mult_bias.svg){#fig:intro_mult_bias width=100%}

#### ZDT

[@raw:ZitzlerDT00] is a test suite that consists of a set of two-objective
problems and takes its name from its authors Zitzler, Deb and Thiele. In
their paper the authors propose a set of 6 different scalable problems
all originating from a well thought combination of functions allowing,
by construction, to measure the distance of any point to the Pareto
front. Each test function involves a particular feature that is known to
cause difficulties in the evolutionary optimization process, mainly in
converging to the Pareto-optimal front. For the evaluation of our
combinational surrogate model we selected the following problems:

-   **ZDT1** has a convex Pareto optimal front.

-   **ZDT2** has a non-convex Pareto optimal front.

-   **ZDT3** adds a discreteness feature to the front. Its Pareto optimal
    front consists of several noncontiguous convex parts. The
    introduction of a sine function in this objective function causes
    discontinuities in the Pareto optimal front, but not in the
    parameter space.

-   **ZDT4** has 21 local Pareto-optimal fronts and therefore is highly
    multimodal. It is also called a *multifrontal* problem.

-   **ZDT6** has a non-uniform search space: the Pareto optimal solutions
    are non-uniformly distributed along the global Pareto front and the
    density of solutions is the lowest near the Pareto optimal front and
    highest away from the front.

#### DTLZ

[@raw:DebTLZ05] is an extensive test suite that takes its name from its
authors Deb, Thiele, Laumanns, and Zitzler. It was conceived for
multi-objective problems with scalable fitness and objective dimensions.
All problems in this test suite are box-constrained, continuous,
n-dimensional, multi-objective problems.

-   **DTLZ1** is one of the most difficult test problems in this test set.
    DTLZ1 has a flat landscape and the optimal Pareto front lies on a
    linear hyperplane.

-   **DTLZ2** is an unimodal problem with a concave Pareto front.

-   **DTLZ3** is a multimodal problem with a concave Pareto front. DTLZ3 is
    intended to make convergence on the optimal Pareto front more
    difficult than for DTLZ2.

-   **DTLZ4** is an unimodal problem with a bias toward a dense region of
    solutions.

-   **DTLZ5** has a bias for solutions close to a Pareto optimal curve. This
    problem may be easy for an algorithm to solve. Because of its
    simplicity, it is recommended to use it with a higher number of
    objectives.

-   **DTLZ6** is a more challenging version of the DTLZ5 problem. It has a
    non-linear distance function $g()$, which makes it more difficult to
    find the Pareto optimal front.

-   **DTLZ7** is an unimodal problem for its first objective and multimodal
    for the rest of its objectives. This problem has a disconnected
    Pareto optimal front, which decreases the likelihood that an Evolutionary algorithm(EA) finds
    all optimal regions.

#### WFG

[@raw:WFGref] is a test suite designed to outperform the previously
implemented test suites. Essential improvements have been achieved in a
many problems. Also, non-separable, deceptive, and mixed-shape Pareto
front problem are included. The WFG test suite was introduced by Simon
Huband, Luigi Barone, Lyndon While, and Phil Hingston. WFG includes the
following problems:

-   **WFG1** is an unimodal problem with a convex and mixed Pareto front
    geometry.

-   **WFG2** is a non-separable and unimodal problem with a convex and
    disconnected Pareto front geometry.

-   **WFG3** is a non-separable, unimodal problem for all but its last
    objective. The last objective is multimodal.

-   **WFG4** is a multimodal problem with a concave Pareto front geometry.
    The multimodality of this problem has a landscape with large hills
    that makes optimization more complicated.

-   **WFG5** is a separable problem with a deceptive landscape and a concave
    Pareto front geometry.

-   **WFG6** is a non-separable and unimodal problem. Its Pareto front
    geometry is concave.

-   **WFG7** is a separable, unimodal problem with a concave Pareto front
    geometry. WFG7 and WFG1 are the only problems that are both
    separable and unimodal.

-   **WFG8** is a non-separable, unimodal problem with a concave Pareto
    front geometry.

-   **WFG9** is a multimodal, deceptive, and non-separable problem with a
    concave Pareto optimal geometry. Similar to WFG6, the
    non-separability of this problem makes it more complicated than WFG2
    and WFG3.

Base on the properties, we decide that ZDT4, ZDT6, DTLZ4, WFG1, and WFG4
can represent a broader spectre of possible problems (Table {@tbl:selected}). Also, solutions to
these problems provide meaningful insight into how our optimization
strategy performs. Therefore, for brevity and more comprehensible
discussion, we present full evaluation only of these problems. However,
we have condensed results for all mentioned problems in appendix.

| **Problem** 	|    **Objective**    	|       **Modality**       	|    **Geometry**   	|       **Bias**       	| **Many-to-one <br>mappings** 	|
|---------	|:---------------:	|:--------------------:	|:-------------:	|:----------------:	|:------------------------:	|
| **ZDT4**    	|   bi-objective  	| unimodal, multimodal 	|     convex    	|         -        	|             -            	|
| **ZDT6**    	|   bi-objective  	|      multimodal      	|    concave    	|         +        	|             +            	|
| **DTLZ4**   	| multi-objective 	|       unimodal       	|    concave    	|         +        	|             +            	|
| **WFG1**    	| multi-objective 	|       unimodal       	| convex, mixed 	| polynomial, flat 	|             +            	|
| **WFG4**    	| multi-objective 	|      multimodal      	|    concave    	|         -        	|             +            	|

Table: Selected multi-objective test problems.
{#tbl:selected}

### Optimization search

In this thesis, we do not perform explicit parameter tuning for
optimization algorithms. While various optimization algorithms could
have been used, we selected MOEAs as default optimization techniques for
surrogate models. The advantage of EAs are that they can be easily
modified and can operate on a set of solutions candidates that are
well-fitted to approximate the Pareto front. Also, EAs can estimate highly
complex problems in various use-cases. In this thesis, we used two types
of EA:

1.  The popular evolutionary multi-objective algorithm *NSGA2*
    [@raw:DebAPM00]. We chose this algorithm due to its popularity in Multi-objective optimization (MOO). In
    all cases, default parameters for the algorithm were used
    (population size = 100, crossover probability=0.95, distribution
    index for crossover=10.0, mutation probability=0.01, distribution
    index for mutation=50.0)[@raw:francesco_biscani_2019].

2.  As an alternative MOEA algorithm for optimization, we define
    *MOEA-Ctrl* that combines MOEA/D [@raw:ZhangL07] and NSGA2 algorithms.
    The characteristic of such an optimization process based on a common
    solutions population for both algorithms. Our intuition behind this
    choice is the following: NSGA2 gives stable results with
    well-distributed points on the Pareto front while MOEA/D has great
    exploration quality with low generation count. The combination of
    this algorithm should gain a better trade-off in exploration and
    exploitation in contrast to individual algorithms' application.

### Surrogate portfolio

Based on our awareness, we selected the most popular models for a
default surrogate portfolio.

1.  **Gaussian Process Regressor**[^1] it is a multi-objective surrogate
    model that commonly used in the Bayesian optimization. For this type
    of model, the initialization should be specified by passing a kernel
    object, the hyperparameters of which are optimized during
    extrapolations of the samples. The kernel for benchmarks is selected
    from the GPML[@raw:RasmussenN10]. Even though this kernel is from
    another domain, it does give good extrapolation quality for the
    regression model. Unfortunately, the build time is significant and
    grows with samples size and dimensionality.

2.  **Support Vector Regression (SVR)**[^2] single-objective model with
    Radial-basis function(RBF) kernel. Surrogate based on RBF and SVR
    are preferred choice for high dimensional problems
    [@raw:akhtar2019efficient].

3.  **Multi-layer Perceptron regressor (MLPRegressor)**[^3] A neural
    network is a popular and influential approach to approximate the
    functions landscape [@raw:KOURAKOS201313].

4.  **Gradient Boosting Regressor**[^4] is a single-objective model that
    uses an ensemble decision tree regressors to produce a single model.

As a result, for bi-objective problems, there are no more than ten
possible surrogate hypotheses (including multi-objective Gaussian
Process Regressor). For a benchmark purpose, at each optimization round
the surrogate portfolio does not change.

### Benchmark baseline

We compare our approach (TutorM) with Hypermapper
2.0[@raw:nardi2019practical] that was considered in the related work.
Hypermapper focuses on multi-objective parameter tuning with various
types of parameters. It uses several randomized forest models, one for
each objective. The general idea is to scalarize several surrogate
models to single-objective criteria and to optimize them as a
single-objective problem. In addition, a Bayesian model is used to
assist the search for solutions. Hypermapper has successfully been used
in autotuning computer vision applications and database optimization.
Since the sample size is not specified, we chose to use the default
population size for MOEA (100 points).

In addition to Hypermapper, NSGA2 was chosen as it is one of the most
well-known evolutionary algorithms [@raw:RamirezRV19]. It is therefore a
suitable reference point to which to compare other approaches. As
benchmarks, we evaluate two versions of the algorithm that are nearly
identical but have a different budget for evaluation:

-   Small evaluation budget (1000 functions evaluations) and used as a
    competing algorithm

-   Large evaluation budget (10000 and 50000 functions evaluations) and
    used as a baseline. NSGA2 with 10000 functions evaluations budget
    used as a baseline for figures with runtime performance, whereas
    50000 budget used for final results.

Benchmark 1: Portfolio with compositional surrogates. Dynamic sampling plan
---------------------------------------------------------------------------

For this first evaluation step, our approach (TutorM) was compared to
related approaches (Hypermapper and NSGA2) while solving all three sets
of problems described above (ZDT, DTLZ, WFG) for 2 objectives and 2 or 3
parameters. The TutorM includes all features such as dynamic
compositional models, surrogate portfolio and validation.

The solution quality was evaluated using the following metrics:
hypervolume, p-distance, spacing, and number of available non-dominant
solutions (ndf size). The results we present are the average values obtained after five repetitions. It should also
be noted that baseline NSGA2 10k is a static value that is obtained
after 10000 function evaluations.

### One case studies: ZDT6

We start by comparing the runtime performance of the approaches. Let us
consider runtime optimization for the ZDT6 problem. In Figure
{@fig:zdt6_dist}, optimization progress and average distance to the
Pareto front is shown.

![Results of 5 repetitions for ZDT6: Average distance of non-dominant solutions to the real Pareto front.](images/zdt6_dist.svg){#fig:zdt6_dist width=100%}

It is evident that TutorM considerably outperforms NSGA2 and Hypermapper
2.0 right from the start of the optimization process. Our algorithm
quickly reaches optimal and stable results after 300 function
evaluations. As can be seen from another approach, Hypermapper began to
improve values confidently, but then deteriorated and matched with
NSGA2. The presented p-distance is measured from non-dominated solutions
(ndf size) that can be found in Figure {@fig:zdt6_ndf}.

![Results of 5 repetitions for ZDT6: Size of non-dominant solutions across the entire set of the measured solutions.](images/zdt6_ndf.svg){#fig:zdt6_ndf width=100%}

The count of solutions from TutorM grows evenly, reflecting the
stability of the search and the ascent to the real Pareto front. On the
contrary, Hypermapper has a serrated, unstable track that corresponds to
solutions that are stuck in local Pareto fronts. Repeated drops occur
upon the discovery of a new point in the other Pareto optimal fronts.

Figure {@fig:zdt6_models} shows that during the first six optimization
iterations, a sampling plan was used until a valid model appeared. This
suggests that, for a given problem with this surrogate portfolio, the 60
samples obtained from the sampling plan are enough to begin the
optimization process. As can be noted, for this problem and with this
portfolio, the most suitable compositional surrogate is a *Gradient
Boosting Regressor*.

![ZDT6: Best models from the portfolio.](images/zdt6_models.svg){#fig:zdt6_models width=100%}

The final solution consists of non-dominant configurations that give an
idea of the Pareto front. In terms of overall Pareto front
approximations (Figure {@fig:zdt6_front})), only TutorM solutions
reach the baseline (NSGA2 10k) while other solutions are close and
distributed (Hypermapper) or far away and clustered (NSGA2).

![The final assumption of the Pareto optimal solutions (1000 function evaluations) for ZDT6.}](images/zdt6_front.svg){#fig:zdt6_front width=100%}

### Case studies: WFG1, WFG4, DTLZ4

Below, we compare how the optimization process varied across several
problems. The key feature of the method we developed is the dynamic
sampling plan, which depends on the quality of available surrogates. As
mentioned before, in Figure {@fig:zdt6_models}, when a static number
of random samples is estimated, it is possible to make optimal decisions
much earlier.

This approach is used in TutorM for all optimization problems. By
interpreting the end of the sampling plan and the availability of valid
models, we can estimate the cross-grain complexity of the unknown
problem. Figure {@fig:changing_models} shows a difference in the
adaptation of initial samples to problems (DTLZ4, WFG1) and a
corresponding improvement in hypervolume.

![Optimization process with dynamic sampling plan and surrogate portfolio. Plots show in which steps a sampling plan was used or which model gives the best accuracy on the test set. The order of the models in the composite surrogates corresponds to the order of the optimization objectives that this model extrapolates.](images/wfg_dtlz_models.svg){#fig:changing_models width=100%}

In the case of WFG1, a valid model was quickly obtained and reduced the
initial sampling. This may indicate a convenient and unimodal
optimization landscape. On the contrary use-case of DTLZ4, the sampling
plan lasted longer and alternated with valid models. This may reflect
the complexity of the problem, such as the multimodality or bias of the
landscape. It should also be noted that in each case we considered, the
best surrogate model was different and might change during optimization.
Thus, for the case of DTLZ4, a clear advantage was observed in the
choice of composite surrogacy with *Gradient Boosting Regressor*,
whereas for WFG1, the multi-objective *Gaussian Process Regressor* was
the preferred choice.

In the next comparison, we look at WFG1 and WFG4. Figure {@fig:wfg1_ndf} {@fig:wfg1_front}
illustrates how the evaluation budget can be spent to find Pareto
optimal solutions. Let us look at the WFG1. It can be seen that TutorM
slowly increases the number of solutions during optimization
({@fig:wfg1_ndf}). Furthermore, the final result even exceeds the
solutions given by the NSGA2 after 10k function evaluations
({@fig:wfg1_front}). Turning now to Hypermapper, the non-dominated
plot is highly serrated, which indicates that the approach falls within
the local optima. Additional information is revealed in the final Figure
{@fig:wfg1_front}, which shows that most final Hypermapper solutions
are strongly clustered, reflecting a waste of resources.

For the WFG4 use-case, all approaches produce near-optimal solutions,
but only TutorM provides such an extensive set of near-optimal solutions
(non-dominated 400 solutions from 1000 function evaluations). This
property of TutorM means that the optimization process can stop earlier
and save on the evaluation budget.

![Results of 5 repetitions for WFG1: Size of a non-dominated subset of evaluated examples](images/wfg1_ndf.svg){#fig:wfg1_ndf width=100%}

![WFG1: Pareto front approximation](images/wfg1_front.svg){#fig:wfg1_front width=100%}

![Results of 5 repetitions for WFG4: Size of a non-dominated subset of evaluated examples](images/wfg4_ndf.svg){#fig:wfg4_ndf width=100%}

![WFG4: Pareto front approximation](images/wfg4_front.svg){#fig:wfg4_front width=100%}

### Results

For benchmark 1, we analyze 21 problems from three test sets. They have
2 or 3 parameters and 2 objectives. We repeat the experiments 5 times
and average them. We consider the following metrics:

-   **Hypervolume** This metric is calculated for each comparison
    because the hypervolume requires a single reference point for a
    group of competitors. Hypervolume metric is given as a percentage
    where $100\%$ corresponds to the maximum volume in the competition
    and $0\%$ corresponds to the hypervolume of a random set of
    solutions.

-   **p-distance** The primary metric for evaluation that corresponds to
    average distance to real Pareto front. Unfortunately, it is not
    available for WFG problems.

-   **Non-dominated font (ndf) size** The ratio of the number of final
    non-dominated decisions to the number of spent function evaluations.

-   **Spacing** The inverse spacing metric is calculated, where 1
    corresponds to the most cohesive decisions among competitors.

In following table (Table {@tbl:magic_five}), we present a subgroup of problems that
have varying complexity. The full list of results is provided in the appendix.

|            	|                 	| **ZDT4**     	| **ZDT6**   	| **DTLZ4**    	| **WFG1**   	| **WFG4**   	|
|------------	|-----------------	|----------	|--------	|----------	|--------	|--------	|
| TutorM     	| **Hypervolume** ↑   	| 99,80%   	| 99,43% 	| 99,83%   	| 95,75% 	| 99,28% 	|
|            	| **p-distance** ↓    	| 0,01     	| 0,09   	| 0,001    	| -      	| -      	|
|            	| **ndf-size** ↑      	| 50%      	| 4,26%  	| 0,2%     	| 3,44%  	| 38,9%  	|
|            	| **space-metric** ↑  	| 0,78     	| 0,17   	| 0,666    	| 0,51   	| 1      	|
| NSGA2      	| **Hypervolume** ↑   	| 83,43%   	| 83,84% 	| 87,81%   	| 30,52% 	| 83,95% 	|
|            	| **p-distance** ↓    	| 0,04     	| 1,29   	| 0,002    	| -      	| -      	|
|            	| **ndf-size** ↑      	| 8,77%    	| 1,01%  	| 9,600%   	| 3,18%  	| 10%    	|
|            	| **space-metric** ↑  	| 0,19     	| 0,04   	| 0,323    	| 0,28   	| 0,58   	|
| Hypermaper 2.0| **Hypervolume** ↑   	| 97,32%   	| 82,86% 	| 64,579%  	| 44,12% 	| 84,39% 	|
|            	| **p-distance** ↓    	| 0,9      	| 1,12   	| 0,059    	| -      	| -      	|
|            	| **ndf-size** ↑      	| 5,42%    	| 6,25%  	| 1,17%    	| 10,24% 	| 3,26%  	|
|            	| **space-metrics** ↑ 	| 0,11     	| 0,08   	| 0,029    	| 0,31   	| 0,06   	|
| NSGA2 50k <br>(Baseline) 	| **Hypervolume** ↑   	| 100%     	| 100%   	| 100%     	| 100%   	| 100%   	|
|                  	| **p-distance** ↓    	| 2,04e-05 	| 0,0003 	| 8,81e-06 	| -      	| -      	|
|            	| **ndf-size** ↑      	| 0,72%    	| 0,72%  	| 0,360%   	| 0,72%  	| 0,72%  	|
|            	| **space-metric** ↑  	| 1        	| 1      	| 1,000    	| 1      	| 0,6    	|

Table: Comparison of results after 1000 function evaluations.
{#tbl:magic_five}

To summarize, it follows from our results that our strategy generally
gives optimal or better results than the baseline on the majority of
investigated problems.

We assume that our positive results were due to the new features we
implemented, such as a surrogate model portfolio and adaptive sampling
plan. These features have yielded significant results on almost all
problems. However, we did not apply inner parameter tuning: in all
experiments, TutorM was used with default parameters.

Benchmark 2: Inner parameters
------------------------------

For the second benchmark, we investigated whether it is possible to
further improve the performance of TutorM by tuning its parameters. We
examine the effect of internal parameters on the performance and quality
of optimization. As was mentioned in the previous section, it was
applied with a default setting.

### TutorM parameters

Besides the standard model-based parameters, it is necessary to
investigate the impact of additional TutorM parameters such as
validation thresholds, test-set and prediction size. This research is
needed to select the configuration that can improve results of the
existing system. Unfortunately, there is insufficient information
available about how to configure model-based parameter optimization
[@raw:TobiasCV; @raw:HybridSurrRCG]. Filling this gap in knowledge will be
useful not only for the availability of TutorM but also for general
tuning of model-based optimization. Due to limited time, we consider
only the ZDT4 and ZDT6 problems using the surrogate portfolio from the
first benchmark, but without the *Gaussian regression model*. This model
takes a long time to train and the full factorial design did not fit
within our time frame. The following parameters are exposed in the
developed TutorM class:

-   **Initial dataset** \[`0`, 100, 500, 750\]. It is the initial number of
    points obtained from sampling plan. At the same time, the total
    budget for measurements remains unchanged and equals 1000. The
    default value is `0`.

-   **Surrogate validation.** Criteria and parameters for evaluating the
    usefulness of the surrogate model.

    -   **Train/test split** \[`75/25`, 90/10\] is a splitting proportion in
        which the samples available for training and testing are
        divided. Train and test sets are crucial to ensure that the
        surrogate model is able to generalize well to new data. The
        default value is `75/25`.

    -   **Cross-validation threshold**\[0.2, `0.65`, 0.9\] is a minimum
        accuracy threshold for any round in cross-validation(CV). CV is
        used to select valid surrogate models and avoid overfitting. The
        default values is `0.65`.

    -   **Test threshold** \[0, `0.6`, 0.9\] is a minimum accuracy threshold
        for the test set. The accuracy obtained from the test set and is
        used to verify the validity of models based on how they
        extrapolate unknown data. The default value is 0.6.

-   **Optimization search algorithm** \[NSGA2, `MOEA-Ctrl`\] optimization algorithm
    for multi-objective solutions. The default value is `MOEA-Ctrl`.

-   **Solution combinations** \[Non-dominated front score (ndf score),
    `Stacking` \] approach for choosing a set of solutions from a valid surrogate
    model. Since several models can be valid and each one provides its
    own set of decisions, we have a range of options. *Non-dominated
    front score (ndf score)* prefers the surrogate model with the
    highest precision for non-dominant solutions, whereas the *stack*
    integrates all available surrogate solutions into one set of
    solutions. The default value is `Stacking`.

-   **Prediction count** \[`10`, 100\] number of random solutions for the
    real evaluation that are selected from the set of solutions. The
    default value is `10`.

As a result of the full factorial design, 576 possible combinations were
obtained. Each combination was repeated five times and averaged.
Conclusions were made based on the 40 best and worst combinations.

First, we will consider the ZDT6 problem. Inspection of Figures
{@fig:zdt6_w} {@fig:zdt6_b} indicates that the *solution combination* made the
most significant impact on the result.

![ZDT6: Average result of the worst configurations](images/conf_zdt6_worst.svg?sanitize=true){#fig:zdt6_w width=100%}

![ZDT6: Average result of the best configurations](images/conf_zdt6_best.svg?sanitize=true){#fig:zdt6_b width=100%}

There is a definite advantage in combining solutions into a stack. The
second most important parameter is the *Optimization search
algorithm*(Solver). The best configurations prefer to pick a combination
of Genetic Algorithms (MOEA-Ctrl) for optimization.

Let us look at the *solution combination* and the *Optimization search
algorithm* options in more detail (Figure {@fig:conf_zdt6_sign}).

![Correlation between the most influenceable parameters for the ZDT6: solution combination strategy and optimization algorithm](images/conf_zdt6_solver.svg){#fig:conf_zdt6_sign width=100%}

The impact of changing the algorithm is highly dependent on the solution
combination strategy. Improvement in results for MOEA-Ctrl is more
significant when the results are combined into a stack. This advantage
can be explained by the fact that the stack reduces the bias of
surrogate models while the combination of genetic algorithms decreases
prediction variance. Now we will look at the ZDT4 problem (Figure {@fig:zdt4_w} {@fig:zdt4_b}).

![ZDT4: Average results of the worst configurations](images/conf_zdt4_worst.svg?sanitize=true){#fig:zdt4_w width=100%}

![ZDT4: Average results of the best configurations](images/conf_zdt4_best.svg?sanitize=true){#fig:zdt4_b width=100%}

The results are similar to those obtained with the ZDT6 problem: the
solutions stack take part almost in all of the best configurations.
However, for this problem, there is no clear dominance of a single
algorithm. Yet, the validation thresholds have an impact on results
(Figure {@fig:conf_zdt4_sign}).

![An impact of the cross-validation threshold for the ZDT4.](images/conf_zdt4_cv_score.svg){#fig:conf_zdt4_sign width=100%}

A significant difference is seen for the cross-validation threshold in
the case of *ndf score* *solution combination* set (Figure
{@fig:zdt4_w}). It should be noted that the stack makes the
validation threshold impact less significant, as evident from Figure
{@fig:conf_zdt4_sign}. This influence is related to this technique’s
ability to reduce the bias of solutions.

Another interesting conclusion can be made from the *initial sample
size*. The worst and the best configurations are most affected by tha
absence of a sampling plan. The reason for this is that the small number
of samples may lead to a surrogate model fallacy in extrapolation the
search space while, at the same time, the small number of samples
provide more opportunities for optimization search.

### Sampling plan size

The purpose of this experiment is to review the dependencies between the
optimization results and the sampling plan size. The Hypermapper was
selected as a foundation for analysis because it has a static
implementation of the optimization algorithm with the surrogate model.

The results are shown in the following Figure {@fig:hmapper_start_set}.

![Influence of the initial sample plan on optimization process with Hypermapper 2.0](images/hypermapper_start_set.svg){#fig:hmapper_start_set width=100%}

For WFG problems, the criterion is hypervolume and for ZDT problems it
is p-distance. Of all the results, the initial sampling plan has the
smallest effect on the WFG4. Since this problem is unimodal, the model
requires fewer samples for extrapolation. Other problems have a more
complicated multimodal landscape that is shown by unstable results.

### Results

We investigated the parameters of TutorM and determined which ones
produce the best results. Also was noticed that *Solution combinations*
and *Optimization search algorithm* had the most significant impact on
solution quality. The *stack* of solutions with MOEA-Ctrl is the best
combination of parameters to use as a default for TutorM. The other
parameters tested have a much smaller effect.

Benchmark 3: Scalability of surrogate models
--------------------------------------------

Not only the type of the problem landscape but also its dimensions are
essential factors for picking a surrogate model. The advantage of a
surrogate model can be lost if the number of parameters or criteria is
changed. The goal of this experiment is to find out the scalability of
surrogate models.

The following surrogates were selected for evaluation:

-   *Gaussian Process Regressor* with kernel design from
    GPML[@raw:RasmussenN10]. Gaussian process models are well-known and are
    commonly used in Bayesian optimization for a wide variety of
    problems [@raw:EmmerichGN06; @raw:MlakarPTF15].

-   *MLPRegressor* is a neural network implementation from the *sklearn*
    framework. Neural networks can automatically discover useful
    representations in high-dimensional data by learning multiple layers
    [@raw:WilsonHSX16]. Because this model simultaneously extrapolates all
    objectives, we chose an architecture that consists of 5 layers and
    100 neurons per layer.

-   The surrogate portfolio includes Gradient Boosting Regressor,
    MLPRegressor, and *SVR (RBF kernel)*, as mentioned in
    Benchmark 2.

The DTLZ2 problem was selected to evaluate the scalability of the
surrogate models. It is an unimodal problem with multiple global optima
and concave geometry of the Pareto front. During experimentation with
DTLZ2, the number of optimization criteria changed with a constant
number of parameters. Figure {@fig:scale_dtlz2} shows the three
selected surrogate strategies with the average distance to the Pareto
front (first row) and time spent per optimization iteration (bottom
row). For all cases, the experiment was repeated five times.

![Scaling example for the three variants of the surrogate on the DTLZ2 with the 9-dimensional parameter space](images/scale_dtlz2.svg){#fig:scale_dtlz2 width=100%}

As illustrated by Figure {@fig:scale_dtlz2}, *Gaussian Process
Regressor* model provides significantly better results relative to other
approaches, but only for the bi-objective problem. Increasing the number
of objectives to four leads to only the *MLPRegressor* and surrogate
portfolio converging on an optimal solution. Further increasing the
number of objectives makes the search space too complicated, and all
approaches fail to find solutions.

### Results

The ability of models to estimate the search space depends on their
hyperparameters. As an example: *Gaussian Process Regressor* are highly
dependent on the kernel while *MLPRegressor* depends on a number of
layers. In turn, for the surrogate portfolio, the parameters determine
how to *build and select* surrogate models. In the portfolio, a single
model with varying parameters is evaluated as a set of separate
entities. Thus, the scalability required to solve multi-dimensional
problems can be generated by surrogate portfolios.

Discussion of results
---------------------

The purpose of this thesis is to investigate the use of a cross-grained
compositional model for solving multi-objective problems. In this
evaluation section, we provided an extensive comparative analysis of the
performance of our and other techniques on a wide range of problems. The
analysis also included an exhaustive study of the possible parameters
and the impact of the sampling plan on results. The possibility of
scaling surrogate models by increasing the number of objectives was also
tested.

We draw the following conclusions from our evaluation experiments:

1.  TutorM is far ahead of its counterparts (Hypermapper 2.0 and NSGA2)
    and achieves optimal results while sparing function evaluations.

2.  Parameter analysis for TutorM shows that results are significantly
    improved by combining solutions with multiple surrogates (solution
    stack).

3.  When the possibility of scaling up the surrogate portfolio was
    tested, we determine that dynamically selecting an appropriate
    surrogate model for the specific dimensionality of the problem is
    essential.

[^1]: [scikit-learn.org]{}: sklearn.gaussianprocess.GaussianProcessRegressor

[^2]: [scikit-learn.org]{}: sklearn.svm.SVR

[^3]: [scikit-learn.org]{}: sklearn.neural network.MLPRegressor

[^4]: [scikit-learn.org]{}: sklearn.ensemble.GradientBoostingRegressor


text:
# Unreleased

- bump dependencies, fix typescript errors
- feat: show sidebar contents with overflow so that you can see if things are run multiple times with the same name
- feat: migrates to ember-template-imports for easier feature additions and changes

# 0.5.0 (12/08/2020)

- major bumps for all dependencies
- ensures that error modal scrolls to the line that currently has the error

# 0.4.1 (08/03/2020)

- fixes an issue where the progress bar never goes away after successful build
- fixes bug in table rendering which didn't allow data to update after changed

# 0.4.0 (07/31/2020)

- ensures that even when builds fail they are still viewable. This change makes buildState fields nullable.

# 0.3.0 (06/15/2020)

- ensures that if user serves ember application with `ember serve --path=dist`

# 0.2.5 (06/03/2020)

- instantiationStack component is now 400px instead of 700px and also the sidebar with the stack itself is scrollable instead of growing to whatever size the list needs.
- All condensable lists now extend CondensableComponent which will only provide the required amount of items to help with list rendering performance
- Remove attributes from graphql queries we aren't using
- add tooltip on plugin list to ensure plugins are readable

# 0.2.4 (06/01/2020)

- Search results are more consolidated
- Search results empty state looks as expected
- Fixes issue with table where sorting values are not picked correctly
- Ensure that plugin types that are formed like (broccoli-persistent-filter:Babel > [Babel: broccoli-inspector]) group by the first string matching (broccoli-persistent-filter:Babel)
- Fixes bug where plugins that were grouped could not be uncollapsed
- Catches graphql errors on build page and display modal
- Adds banner updates that specifies that ember-cli versions < 3.11.0 are not supported.

# 0.2.3 (05/27/2020)

- Adds the ability to download data from builds
- Scroll the file to the line number selected from stackTrace
- Adds modal banner to show when broccoli-inspector does not support the project it is being included in

# 0.2.2 (05/21/2020)

- Updated logo design thanks to Denis Toledo https://www.denistoledo.dev/

# 0.2.1 (05/19/2020)

- updates table styling to have more distinguished borders

# 0.2.0 (05/18/2020)

- major design overhaul
- adds error modal for when the broccoli funnel fails to build properly (#16)
- fixes places where ms wasn't sorting correctly

# 0.1.2 (05/11/2020)

- Surfaces monitors in the heimdall custom tab section as well
- Updates readme to contain information on how to access the ui.

# 0.1.1 (05/07/2020)

- instantiationStack viewer is now inline
- broccoli logo is used as favicon and navbar icon
- input and output node wrappers are now next to each-other
- all table bodies can now be collapsed

# 0.1.0 (05/06/2020)

- system info information looks like `| key | value |`
- shows versions from process.versions on dashboard
- add line numbers to instantiationStack on node-info page
- change `Custom Heimdall Information` to `Heimdall Schemas`
- `Heimdall Schemas` are now formatted in a tab view
- Instance stack is now clickable and will show the user the file contents in a modal
- Sorts numbers correctly by allowing the inclusion of raw values to be used in sorting
- Shows outputNodeWrappers on node-info page

# 0.0.9 (05/05/2020)

- show custom heimdall stats object
- adds empty state for search results coming back empty
- shows the ellipses for search results stringValue so that the user knows there is more data behind and should click into the plugin to see more
- Updates readme to explain how broccoli inspector works
- tables will condense values and allow the user to expand if wanted
- tables sort strings and number values correctly
- adds system info information to the dashboard
- major design overhaul

# 0.0.8 (04/30/2020)

- only sends down the string diff that is needed instead of the entire file. Reduces network download size by more than half.

# 0.0.7 (04/30/2020)

- adds loading states for sidebar to only show up when data has loaded
- condense sidebar to only show 10 items initially
- while building crawl input and output paths to get the files on the node. This is going to make searching way faster on any project. Just searching on this project went from 6s to 8ms.

# 0.0.6 (04/29/2020)

- fix label formatting for total fs timing data to turn us to ms.
- move group by plugin to sidebar from Navbar
- consolidates navbar to have `|input| |links|`
- show node breakdown by fs and other (other being the time spent in the plugin that we don't have instrumentation to pin down where it is being spent.)
- Move search box for plugins into the right rail, this is specifically for search by plugin name
  - This functionality is done locally
- adds a link to table that will download the data as a csv
- be able to sort column values in tables
- adds a new search page that allows the searching of multiple fields such as derived fields like inputFiles and outputFiles

# 0.0.5 (04/28/2020)

- ui cleanup
- shows the selected plugin in the list when selected
- sort plugins by type by time
- shows the total time of nodesByType
- adds dashboard route to be able to show high level information

# 0.0.4 (04/26/2020)

- show total plugins in rollup list
- show total build time in progressbar when build is finished
- route name is `/_broccoli-inspector` instead of `/broccoli-inspector`
- group plugins by default
- show nodeInfo
- allows table to take tagName to render text in custom wrappers

# 0.0.3 (04/23/2020)

- subclasses the apollo service and serves graphql requests over the same location as the application url. This means that consumers don't need to specify what url their application is being served over.

# 0.0.2 (04/23/2020)

- fix dependencies from being in devDependencies
- doesn't build on install, builds on prepublish

# 0.0.1 (04/22/2020)

- Basic functionality works
- Tied to ember-cli middleware functionality
- Leverages FS timing from `EMBER_CLI_INSTRUMENTATION=1`

repository: gabrielcsapo/broccoli-inspector

gha_language: JavaScript

repo_name: gabrielcsapo/broccoli-inspector


text:
Percolator
==========

Percolator is a tool for simulating [percolation](https://en.wikipedia.org/wiki/Percolation_theory) on a planar lattice.

Currently it only does site percolation on the square lattice.

Screenshots
-----------

![screenshot 1](screenshots/screenshot_1.png)

![screenshot 2](screenshots/screenshot_2.png)

![screenshot 3](screenshots/screenshot_3.png)

![screenshot 4](screenshots/screenshot_4.png)

Installing
----------

Percolator runs on Windows and Linux.

For Linux, see the building procedure below.

Windows binaries are [available here](https://yakov.shklarov.com/percolator/).

Building
--------

**Linux**: Install CMake and GLFW (if you're on debian: packages cmake and libglfw3-dev). Then use the standard CMake build procedure. For example:

    $ git clone git@github.com:yshklarov/percolator.git
    $ mkdir percolator/build
    $ cd percolator/build
    $ cmake ..
    $ cmake --build . -v -j8
    $ ./percolator

**Windows**: Load the folder as a CMake project in you favorite IDE. All external includes and
libraries are already in the source tree. The build has been tested with MSVC 19.25.28612 on x64.

**Other platforms**: Percolator uses [ImGui](https://github.com/ocornut/imgui) for the user
interface. ImGui supports many different platforms and graphics backends, so it should be
relatively straightforward to get Percolator to build on your system.

repository: yshklarov/percolator

repo_name: yshklarov/percolator


text:
---
layout: post
title: Sysadmin by Google
---

I am not a sysadmin.  In fact, I'm every sysadmin's worst nightmare: I'm a power user that has access to `sudo`.  I run a few machines and when there are problems, I follow the [xkcd approach](https://xkcd.com/627/).  This leads to me copy-pasting in commands that I found over google, usually on stackexchange.  This is how science advances.  This post details my experience trying to run a multi-user OpenStack project here.  The basic issue is that we have one (1) public IP address for our VMs and many users and instances.  There are two possible approaches.  The nice route would be to just configure the virtual router on the openstack cloud to do this forwarding automagically.  Alternatively, we could make a routing VM where we can address this directly.

## Managing the Virtual Router

I can't find a way to access this functionality without access to the underlying OpenStack interface, i.e., this seems supported but it's not a user-space option.  It does seem [possible and preferred](https://blueprints.launchpad.net/neutron/+spec/router-port-forwarding).

## Creating a VM router

### The longer saga of trial and error.

First, I created a new security group that allowed for custom TCP access on a range of ports.  Let's say it's 2201 to 2222.  It isn't, but that's good for now.

On the host VM, I edit `/etc/ssh/ssh_config` to inclue the lines

	Port 2201
	Port 2202
	...
	Port 2222

and I do the same thing in `/etc/ssh/sshd_config`.  I then restarted ssh: `service ssh restart`.

Now, I can ssh into the gateway VM on nonstandard ports.  Next up, I'll try to pick off these ports with an `iptables` and send them onto another VM.  First, I allow port forwarding on the gateway VM by editing `/etc/sysctl.conf`

	net.ipv4.ip_forward=1
	# or for a one-off:
	sysctl -w net.ipv4.ip_forward=1

Finally, I set up `iptables`:

	iptables -t nat -A PREROUTING -p tcp --dport 2201 -j DNAT --to-destination <IP_ADDRESS>:22
	iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

One cool thing that came of this was the ability to ssh through to the private machines using `ssh-agent`.  This is fine for me but it doesn't do anything to help anyone who doesn't have their ssh keys injected into the server.  I could create users and allow administration, but that defeats the whole point of the OpenStack exercise.

	ssh-agent
	ssh-add /path/to/ssh/privatekey

	ssh -A<EMAIL_ADDRESS>	ssh<EMAIL_ADDRESS>

### Here's a bunch of stuff that didn't work.

One solution suggested something like this:

	 iptables -t nat -A POSTROUTING -d <IP_ADDRESS>/24 -o eth1 -j SNAT --to-source XXX.XXX.XXX.XXX
	 iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 2201 -j DNAT --to <IP_ADDRESS>:22
	 iptables -A FORWARD -p tcp -d <IP_ADDRESS> --dport 2201 -j ACCEPT

I note that the VMs only come with one virtual `eth0` NIC.  Again, we hit the problem that a lot of the established solutions want the VM to be built like a proper switch/router with an extra `eth1` port.

Cybera's old instructions say that all you need to do is:

	iptables -t nat -A PREROUTING -p tcp --dport 2201 -j DNAT --to-destination <IP_ADDRESS>:22

However, they advise using a specific `RAC Proxy` VM with the software already installaed.  It's not clear if this image has a second NIC in it or not.  Another location suggests adding something to the main tables (i.e., not the NAT tables) to allow a forward:

	iptables -A FORWARD -p tcp -d <IP_ADDRESS> --dport 22 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT

Maybe the above could use some input port control as well `--sport 2201`.  Or the interface (`-i eth0`)  Some cases suggest including a `MASQUERADE` flag:

	iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

However, this again is a `eth0` and `eth1` case.  Things aren't looking good for our heros.  I'm not sure but it seems like we want to provision VMs with another NIC.


text:
The component crops a given string in the middle, if it gets too long. It even is responsive.

```
<div style={{maxWidth: '400px'}}>
    <CroppedText>The great next sentence is false. The previous great sentence is really great and true.</CroppedText>
</div>
```

repository: sulu/sulu

gha_language: PHP

repo_name: sulu/sulu


text:
# Coins SDK for .NET

This library provides a virtual currency backed by a [Blockmason Link][1]
project.

## Installing

Add the following line to your project file:

```
<PackageReference Include="Blockmason.Coins" Version="1.0.0"/>
```

[Sign up][2] for Blockmason Link and copy/paste the contents of
**Blockmason.Coins.sol** into your project.

## Usage

Import this library:

```
using Blockmason.Coins;
```

Create a treasury to manage your coins:

```
// Replace with your Link project's Client ID and Client Secret
Treasury treasury = new Treasury("<client-id>", "<client-secret>");
```

Mint some coins for one of your users:

```
// This library just needs a numeric user ID to keep track of who owns what
Coin coin = await treasury.Mint(userId, amount);
```

Burn coins from the supply:

```
await treasury.Burn(userId, amount);
```

Transfer a stack of coins between two users:

```
await treasury.Transfer(coin, toUserId);
```

A `Coin` has a `Holder` and an `Amount`.

[1]: https://blockmason.link/
[2]: https://mason.link/sign-up


text:
# Platform-dependent Code

The Pony libraries, of course, want to abstract platform differences. Sometimes you may want a `use` command that only works under certain circumstances, most commonly only on a particular OS or only for debug builds. You can do this by specifying a condition for a `use` command:

```pony
use "foo" if linux
use "bar" if (windows and debug)
```

Use conditions can use any of the methods defined in `builtin/Platform` as conditions.
There are currently the following booleans defined: `freebsd`, `linux`, `osx`, `posix` => `(freebsd or linux or osx)`, `windows`, `x86`, `arm`, `lp64`, `llp64`, `ilp32`, `native128`, `debug`

They can also use the operators `and`, `or`, `xor` and `not`. As with other expressions in Pony, parentheses __must__ be used to indicate precedence if more than one of `and`, `or` and `xor` is used.

Any use command whose condition evaluates to false is ignored.

repository: ponylang/pony-tutorial

repo_name: ponylang/pony-tutorial


text:
# Detecting Pedestrian behaviors
This is a project that makes object dection classifier on Pedestrian behaviors by using Tensorflow Object Detection API. I've followed https://github.com/EdjeElectronics/TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10 instructions to set up Tensorflow Object Detection API and used LabelImg to annotate the pedestrian behaviors that I personally defined.
## Motivation
In Autonomous driving industry, the most important thing to consider is public safety. Therefore, prediction on other cars' and pedestrian's behaviors are one of the key features for public safety.
It is important to predict the other cars' behaviors; however, predicting pedestrian behaviors might be more important to focus on because when an accident involves with predestrians, there is a high probability of that accident is being a fatal accident. If we can predict what is a pedestrian's intent on the public road, it will make easier for a self-driving car to maneuver around pedestrians.
## Pedestrian Behaviors
These are defined by me. The reason behind of these is if pedestrians are not aware of a self-driving car is approaching to them, they might suddenly change a direction of travelling or even come toward a self-driving car. And this can cause a harsh brake or even an accident due to the lack of time to react for a self-driving car. On the other hand, the self-driving car has to be very sensitive and that can cause unnecessary brakes or awkward nudges without the information of pedestrians are aware of a self-driving car. Therefore, I believe knowing whether pedestrians are aware of a self-driving car or not is essential for what actions a self-driving car to execute around pedestrians.
```
1. n_looking/g: A pedestrian is not looking at the vehicle and crossing the road
2. n_looking/ng: A pedestrian is not looking at the vehicle and not crossing the road
3. looking/g: A pedestrian is looking at the vehicle and crossing the road
4. looking/ng: A pedestrian is looking at the vehicle and not crossing the road
```
## Process of Training a customized dataset
***1.*** Get clips of drive view videos that have pedestrian in it
***2.*** Cut by frames of the clips
***3.*** Annotate images with bounding boxes and labels (Pedestrian Behaviors)
***4.*** Generate train and test tfrecord files based on images and xml files
***5.*** Choose what model I'm going to use for object detection(Faster R-CNN)
***6.*** Use Google Colab to train the model
***7.*** Use the model to predict pedestrian behaviors on new images or videos
## Structure
```
├──README.md
├──Report.pdf: Explain how I approach this project in slides format
├──project_proposal.pdf: Explain what motivations are behind in this project
├──resize_img.py: Resize the pixel size of images if images are too big for training the model
├──xml_to_csv.py: Convert xml files that are created when you labeled the image by LabelImg to csv files
├──generate_tfrecord.py: Convert csv files to tfrecord files which are propriate train the model on Tensorflow
├──training_on_colab.ipynb: Contains commends that enable Colab to access cloud powered GPU to use Tensorflow-gpu, and train the model
├──object_detection_image.py: Use trained model and execute the prediction on a single image
├──object_detection_video.py: Use trained model and execuete the prediction on frames of a video
├──create_video.py: Use frames from the output of object_detection_video.py to create a video
├──training: Contains config file for faster-rcnn-inception-v2-coco-2018-01-28 and labelmap.pbtxt
├──test_imgs: Results on images
└──test_videos: Results on videos
```
### Results on videos
![](test_videos/test_video_1.gif)
![](test_videos/test_video_2.gif)
![](test_videos/test_video_3.gif)


text:
# Statistical Rethinking: A Bayesian Course Using Python and NumPyro

[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/asuagar/statrethink-course-in-numpyro/main)

## Intro

This repo contains the `python`/`numpyro` version of the Statistical Rethinking course that Professor Richard McElreath taught on the Max Planck Institute for Evolutionary Anthropology in Leipzig during the Winter of 2019/2020. The original repo for the course, from which this repo is forked, can be found [here](https://github.com/rmcelreath/statrethinking_winter2019). The course contains 20 lectures structured in 10 weeks with a series of assignments for each week.  The course is an excellent introduction to bayesian modelling in general and to the Rethinking Statistics wonderful [book](https://xcelab.net/rm/statistical-rethinking/) written by Professor McElreath.

The present work is a derivative of [Statistical Rethinking: A Bayesian Course Using python and pymc3](https://github.com/gbosquechacon/statrethink_course_in_pymc3) by Gabriel Bosque Chacon. He did an incredible work doing the PyMC3 version of the Statistical Rethinking course. I made the numpyro code, the seaborn figures and very minor modifications to their comments.

## How to use this repo

All the notebooks can be interactively used through the "launch binder" button located in the top of this file. There are ten `jupyter` notebooks, one for each week of the course. At the beginning of each notebook there are links to the youtube videos of the lectures, the slides used and the original homework questions and answers in `R`.

This repo is recommended to be used as follows:

1. Go to the notebook of the week.
2. Watch the two videos for the lectures of that week.
3. Read the original problems presented to the students and try to solve them on your own.
4. Follow the exercises solutions of the notebook with my code and explanations by Professor McElreath.


text:
Includes `molecules-adjacent` using pattern parameters to override the value of `bar` (to **4**). Additionally, this pattern has an adjacent data file that provides values for `foo` (**4**) and `bar` (**99**).

* `foo`'s value should be taken from this pattern's adjacent data file.
* `bar` would normally also be taken from the adjacent data file, but gets overridden by the the pattern parameter.
* `baz` falls back to the value in `data.json` since neither the adjacent data nor the pattern params override it. Furthermore, the included pattern's (i.e. `molecules-adjacent`) own adjacent data is ignored.

The expected result is therefore: **4, 4, 1**


text:
Windows Terminals and Terminal Emulators
========================================

Microsoft Console API
---------------------

### Windows Console Host

The [Windows Console] terminal application is `conhost.exe`,
implementing one or more screen buffers (a rectangular grid of
characters and attributes), an input buffer (keyboard, mouse, etc.
events) and user preferences. This is used by `CMD.EXE`, PowerShell,
the DOS emulator, and third-party programs natively compiled to use it
such as Python and Docker.

Windows command line programs running under terminal emulators not
supporting this API, such as mintty, may freeze when certain API calls
are made, e.g. to disable typeback when reading passwords. [winpty] is
designed to help with this; see below.

`conhost.exe` first appeared in Windows 7, and was spawned by the
[Client Server Runtime Subsystem][csrss], `csrss.exe`. Since Windows 8
`conhost.exe` is spawned directly by Windows command line programs.

#### Windows Terminal

[Windows Terminal] is a new replacement for `conhost.exe` including
support for `CMD.EXE`, PowerShell, [WSL][] (Windows Subsystem for
Linux) and SSH. Unlike `conhost.exe` it may not remain backward
compatible with older Windows console applications

Source for both is [available on GitHub][gh-ms-terminal].

### winpty

The [winpty] library provides a shim between Windows native console
programs and Cygwin/MSYS ptys. It starts a hidden Windows console
window (`winpty-agent.exe`) and polls its screen buffer for text that
it sends to the pty.

The Cygwin/MSYS Unix adapter, `winpty.exe` (distributed with Git for
Windows), is a command-line tool useful to wrap programs depending on
the Windows console API under `mintty` and Cygwin's `sshd`, neither of
which provides the Windows console API.

Debugging environment variables:
- Set `WINPTY_SHOW_CONSOLE=1` not to hide the Windows console window.
- Run `winpty-debugserver.exe` and set `WINPTY_DEBUG=trace` to log
  library actions in child processes using it.

### MS OpenSSH Server

What terminal API is the MS-provided OpenSSH server providing to
Windows command line programs?

pty/POSIX API
-------------

### mintty

[mintty][] ([Wikipedia][mintty-wp]) is a Windows terminal emulator designed
for use with Cygwin, MSYS, MSYS2, and WSL (Windows Subsystem for
Linux). It provides a POSIX pty interface (based on Cygwin's ptys) to
the application it's displaying.

It will display text I/O from native Windows programs that don't do
anything sophisticated, but even something as simple as Python's
`getpass()` can break/block the terminal. `winpty` above can help fix
this if you don't want to use CMD or PowerShell.

Ctrl-Tab and Shift-Ctrl-Tab will cycle focus between all mintty
windows, similar to Alt-Tab for all windows.

Other
-----

See also Wikipedia's [List of Terminal Emulators][termlist].

### Putty

[PuTTY](ssh.md#putty) provides terminal emulator, but on Windows this
can be used to connect only to serial ports and network connections
via raw TCP, Telnet, Rlogin, and SSH protocols. (The `pterm` generic
client is available only under Unix.)

<!-------------------------------------------------------------------->
[WSL]: https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux
[Windows Console]: https://en.wikipedia.org/wiki/Windows_Console
[Windows Terminal]: https://en.wikipedia.org/wiki/Windows_Terminal
[csrss]: https://en.wikipedia.org/wiki/Client/Server_Runtime_Subsystem
[gh-ms-terminal]: https://github.com/Microsoft/Terminal
[winpty]: https://github.com/rprichard/winpty

[mintty-wp]: https://en.wikipedia.org/wiki/Mintty
[mintty]: https://mintty.github.io/

[termlist]: https://en.wikipedia.org/wiki/List_of_terminal_emulators#Microsoft_Windows

repository: keitaroemotion/sedoc

repo_name: keitaroemotion/sedoc


text:
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [3/13/2020]

No Version Change

- Build/dev improvements
  - Bumped module versions to latest available
  - Switched Windows Build container to use PowerShell 7 instead of PowerShell 7 preview
  - Updated tasks.json to have better integration with InvokeBuild

## [0.8.0]

### Added

- Initial release.

repository: dembeck/PSGalleryExplorer

repo_name: dembeck/PSGalleryExplorer


text:
---
title: What are some ways to treat adult ADHD?
image: /uploads/add.jpg
date: 2016-03-12T21:00:00.000Z
description: Treatment of ADHD symptoms
seotitle: Treatment of ADHD symptoms
seokeywords: 'Adult ADHD, ADD, symptoms, treatments'
seodescription: Treatments for ADHD
---
For anyone with diagnosed adult ADHD, or anyone who suspects they have it, the effects of this sometimes debilitating condition will be well documented. Basically, suffers from adult ADHD can’t be still for long, always on the go, and every day is a struggle to remain calm, keep order, organize daily tasks, and get where they need to be, when they need to be there.

Thankfully help is at hand at South Shore Neuropsychiatric Center in Long Island, through various means that are tailored to the specific person.

For a non-suffer, handling finances is a generally easy thing – yes it might make you cry slightly at your very low bank balance, when you would quite like a bursting rich one, but on the whole, it’s easy to manage. Take an adult ADHD sufferer, and the reality is very different. Organizing and paying bills on time can be difficult, which leads to a vicious circle of not meeting financial commitments, which then makes the sufferer feel down, and depression and anxiety can set in.

This vicious circle needs to be taken into hand, gaining control, through various methods, such as counselling, medications, meditation, and small, easy to remember methods, such as preparation in the morning, arranging everything need for the day the night before, talking yourself through things – these are all ways to handle the condition, and gain control back, so it doesn’t take over a sufferer’s life.

Adult ADHD should not define a person, it is simply a condition that they happen to have, and when help is sought, methods put into place, and recognition given, nobody need live a life devoid of control and happiness.

If you feel you need help, if you’re unsure whether you have the condition and have an inkling that you may, call our helpful staff today, who will discuss your symptoms and needs, and put together a tailor-made treatment plan just for you.

gha_language: Vue


text:
# javiercejudo [![Deploy to Heroku](http://img.shields.io/badge/deploy-heroku-7056BF.svg?style=flat)](https://heroku.com/deploy)

[![Build Status](http://img.shields.io/travis/javiercejudo/javiercejudo.com.svg?style=flat)](https://travis-ci.org/javiercejudo/javiercejudo.com)
[![Coverage Status](http://img.shields.io/coveralls/javiercejudo/javiercejudo.com.svg?style=flat)](https://coveralls.io/r/javiercejudo/javiercejudo.com?branch=master)
[![Code Climate](http://img.shields.io/codeclimate/github/javiercejudo/javiercejudo.com.svg?style=flat)](https://codeclimate.com/github/javiercejudo/javiercejudo.com)
[![Dependency Status](http://img.shields.io/gemnasium/javiercejudo/javiercejudo.com.svg?style=flat)](https://gemnasium.com/javiercejudo/javiercejudo.com)
[![devDependency Status](http://img.shields.io/david/dev/javiercejudo/javiercejudo.com.svg?style=flat)](https://david-dm.org/javiercejudo/javiercejudo.com#info=devDependencies)

[![Selenium Test Status](https://saucelabs.com/browser-matrix/javiercejudo.svg)](https://saucelabs.com/u/javiercejudo)

## Useful Links

Title | Links
:--- | :---
Live | [![Uptime](https://www.statuscake.com/App/button/index.php?Track=EKqPqfW1dF&Days=30&Design=5)](https://www.statuscake.com)
 http://www.javiercejudo.com
 http://javiercejudo.herokuapp.com
Staging | http://staging.javiercejudo.com
 http://javiercejudo-staging.herokuapp.com
Feature branches | http://jc-[ branch_name ].herokuapp.com
Dev | http://<IP_ADDRESS>:5000
Data | https://c3jud0.firebaseio.com/.json?print=pretty
Issue tracker | https://github.com/javiercejudo/javiercejudo.com/issues
Heroku buildpacks | https://github.com/ddollar/heroku-buildpack-multi
 https://github.com/heroku/heroku-buildpack-php
 https://github.com/heroku/heroku-buildpack-nodejs
Chat room | https://gitter.im/javiercejudo/javiercejudo.com
Staging vs. Live
screenshots | http://jc-wraith-shots.s3-website-us-west-2.amazonaws.com
License | [![Lincese](http://img.shields.io/badge/lincese-MIT-blue.svg?style=flat)](LICENSE)

## Technologies

### JavaScript

- [AngularJS](http://angularjs.org/): superheroic JavaScript MVW framework.
- [AngularFire](http://angularfire.com/): a real-time backend for AngularJS from Firebase.
- [jQuery](http://jquery.com/): fast, small, and feature-rich JavaScript library.
- [Modernizr](http://modernizr.com/): the feature detection library for HTML5/CSS3.

### CSS

- [LESS](http://lesscss.org/): the dynamic stylesheet language.
- [Preboot](http://getpreboot.com/): a collection of LESS mixins and variables for writing better CSS.
- [Bootstrap](http://getbootstrap.com/): sleek, intuitive, and powerful mobile-first front-end framework.

### Backend

- [nginx](http://nginx.org/): HTTP and reverse proxy server.
- [PHP](http://php.net/): widely-used general-purpose scripting language that is especially suited for Web development.
- [Firebase](https://www.firebase.com/): scalable real-time backend.
- [CloudFront](http://aws.amazon.com/cloudfront/): Content Delivery Network & streaming.
- [Amazon S3](http://aws.amazon.com/s3/): online cloud storage for data & files.
- [CloudFlare](http://www.cloudflare.com/): the web performance & security company.
- [Foreman](http://ddollar.github.io/foreman/): manage Procfile-based applications.

### Testing

- [Karma](http://karma-runner.github.io/): spectacular test runner for JavaScript.
- [Jasmine](https://jasmine.github.io/): behavior-driven development framework for testing JavaScript code.
- [Sauce Labs](https://saucelabs.com/): Selenium testing, mobile testing, JS unit testing and more.
- [Wraith](https://github.com/BBC-News/wraith): front-end regression testing tool.
- [Coveralls](https://coveralls.io/): test coverage history and statistics.

### Building Process

- [Gulp](http://gulpjs.com/): the streaming build system.
- [Grunt](http://gruntjs.com/): the JavaScript task runner.

### Continuous Integration

- [Travis CI](https://travis-ci.org/): free hosted continuous integration platform for the open source community.
- [Heroku](https://www.heroku.com/): cloud computing designed and built for developers.

### Dependency Management

- [NPM](https://npmjs.org/): the official package manager for [Node.js](http://nodejs.org/).
- [Bower](http://bower.io/): a package manager for the web.
- [David](https://david-dm.org/): a dependency management tool for Node.js projects.
- [Gemnasium](https://gemnasium.com/): monitors your project dependencies and alerts you about updates and security vulnerabilities.

### Quality Tools

- [Code Climate](https://codeclimate.com): quality & security analysis for Ruby on Rails and JavaScript.
- [Scrutinizer](https://scrutinizer-ci.com/): build quality software, better.

### Monitoring

- [Loggly](https://www.loggly.com/): the world's most popular cloud-based log management service.
- [StatusCake](https://www.statuscake.com): website uptime monitoring & alerts.

branch_name: refs/heads/staging


text:
# phpunit-speedtrap

[![Integrate](https://github.com/johnkary/phpunit-speedtrap/workflows/Integrate/badge.svg?branch=master)](https://github.com/johnkary/phpunit-speedtrap/actions)

SpeedTrap reports on slow-running PHPUnit tests right in the console.

Many factors affect test execution time. A test not properly isolated from variable latency (database, network, etc.) and even basic load on the test machine will cause test execution times to fluctuate.

SpeedTrap helps **identify slow tests** but cannot explain **why** those tests are slow. For that consider using [Blackfire.io](https://blackfire.io) to profile the test suite, or another PHPUnit listener [PHPUnit\_Listener\_XHProf](https://github.com/sebastianbergmann/phpunit-testlistener-xhprof), to specifically identify slow code.

![Screenshot of terminal using SpeedTrap](https://i.imgur.com/xSpWL4Z.png)

## Installation

SpeedTrap is installed using [Composer](http://getcomposer.org). Add it as a `require-dev` dependency:

    composer require --dev johnkary/phpunit-speedtrap

## Usage

Enable with all defaults by adding the following code to your project's `phpunit.xml` file:

```xml
<phpunit bootstrap="vendor/autoload.php">
...
    <listeners>
        <listener class="JohnKary\PHPUnit\Listener\SpeedTrapListener" />
    </listeners>
</phpunit>
```

Now run the test suite. If one or more test executions exceed the slowness threshold (500ms by default), SpeedTrap will report on those tests in the console after all tests have completed.

## Config Parameters

SpeedTrap also supports these parameters:

* **slowThreshold** - Number of milliseconds when a test is considered "slow" (Default: 500ms)
* **reportLength** - Number of slow tests included in the report (Default: 10 tests)
* **stopOnSlow** - Stop execution upon first slow test (Default: false)

Each parameter is set in `phpunit.xml`:

```xml
<phpunit bootstrap="vendor/autoload.php">
    <!-- ... other suite configuration here ... -->

    <listeners>
        <listener class="JohnKary\PHPUnit\Listener\SpeedTrapListener">
            <arguments>
                <array>
                    <element key="slowThreshold">
                        <integer>500</integer>
                    </element>
                    <element key="reportLength">
                        <integer>10</integer>
                    </element>
                    <element key="stopOnSlow">
                        <boolean>false</boolean>
                    </element>
                </array>
            </arguments>
        </listener>
    </listeners>
</phpunit>
```

## Custom slowness threshold per-test case

Some projects have a few complex tests that take a long time to run. It is possible to set a different slowness threshold for individual test cases.

The annotation `@slowThreshold` can set a custom slowness threshold for each test case. This number may be higher or lower than the default threshold and is used instead of the default threshold for that specific test.

```php
class SomeTestCase extends PHPUnit\Framework\TestCase
{
    /**
     * @slowThreshold 5000
     */
    public function testLongRunningProcess()
    {
        // Code that takes a longer time to execute
    }
}
```

## Disable slowness profiling using an environment variable

SpeedTrapListener profiles for slow tests when enabled in phpunit.xml. But using an environment variable named `PHPUNIT_SPEEDTRAP` can enable or disable the listener.

    $ PHPUNIT_SPEEDTRAP="disabled" ./vendor/bin/phpunit

#### Use case: Disable profiling in development, but profile with Travis CI

Travis CI is popular for running tests in the cloud after pushing new code to a repository.

Step 1) Enable SpeedTrapListener in phpunit.xml, but set `PHPUNIT_SPEEDTRAP="disabled"` to disable profiling when running tests.

```xml
<phpunit bootstrap="vendor/autoload.php">
...
    <php>
        <env name="PHPUNIT_SPEEDTRAP" value="disabled" />
    </php>

    <listeners>
        <listener class="JohnKary\PHPUnit\Listener\SpeedTrapListener" />
    </listeners>
</phpunit>
```

Step 2) Configure `.travis.yml` with `PHPUNIT_SPEEDTRAP="enabled"` to profile for slow tests when running on Travis CI:

```yaml
language: php

php:
  - 7.3

env:
  - PHPUNIT_SPEEDTRAP="enabled"
```

Step 3) View the Travis CI build output and read the slowness report printed in the console.

[Travis CI Documentation - Environment Variables](https://docs.travis-ci.com/user/environment-variables)

#### Use case: Enable profiling in development, but disable with Travis CI

Step 1) Enable SpeedTrapListener in phpunit.xml. The slowness report will output during all test suite executions.

```xml
<phpunit bootstrap="vendor/autoload.php">
...
    <listeners>
        <listener class="JohnKary\PHPUnit\Listener\SpeedTrapListener" />
    </listeners>
</phpunit>
```

Step 2) Configure `.travis.yml` with `PHPUNIT_SPEEDTRAP="disabled"` to turn off profiling when running on Travis CI:

```yaml
language: php

php:
  - 7.3

env:
  - PHPUNIT_SPEEDTRAP="disabled"
```

Step 3) View the Travis CI build output and confirm the slowness report is not printed in the console.

#### Use case: Only enable SpeedTrapListener on demand via command-line

Useful when you only want to profile slow tests once in a while.

Step 1) Setup phpunit.xml to enable SpeedTrapListener, but disable slowness profiling by setting `PHPUNIT_SPEEDTRAP="disabled"` like this:

```xml
<phpunit bootstrap="vendor/autoload.php">
...
    <php>
        <env name="PHPUNIT_SPEEDTRAP" value="disabled" />
    </php>

    <listeners>
        <listener class="JohnKary\PHPUnit\Listener\SpeedTrapListener" />
    </listeners>
</phpunit>
```

Step 2) When executing `phpunit` from the command-line, enable slowness profiling only for this run by passing the environment variable `PHPUNIT_SPEEDTRAP="enabled"` like this:

```bash
$ PHPUNIT_SPEEDTRAP=enabled ./vendor/bin/phpunit
```

## Using with Symfony Framework

**Executing `vendor/bin/simple-phpunit` will not work while PHPUnit SpeedTrap is installed.**

**Use the PHPUnit binary `vendor/bin/phpunit` while PHPUnit SpeedTrap is installed.**

[Symfony Framework](https://symfony.com/) comes with package [symfony/phpunit-bridge](https://packagist.org/packages/symfony/phpunit-bridge) that installs its own version of PHPUnit and **ignores** what is defined in your project's composer.json or composer.lock file. See the PHPUnit versions it installs with command `ls vendor/bin/.phpunit/`

symfony/phpunit-bridge allows environment variable `SYMFONY_PHPUNIT_VERSION` to define the PHPUnit version it uses. However, this appears incompatible with PHPUnit SpeedTrap.

Please submit a PR if you have a solution!

## Development

Follow these steps to add new features or develop your own fork:

```
# Get source code (or replace with your fork URL)
$ git checkout https://github.com/johnkary/phpunit-speedtrap.git phpunit-speedtrap

# Install dev dependencies
$ cd phpunit-speedtrap
$ composer install

# Run test suite to verify code runs as expected
$ vendor/bin/phpunit
```

## Inspiration

SpeedTrap was inspired by [RSpec's](https://github.com/rspec/rspec) `--profile` option that displays feedback about slow tests.

## License

phpunit-speedtrap is available under the MIT License.

repository: Wennlys/phpunit-speedtrap

repo_name: Wennlys/phpunit-speedtrap


text:
---
title: Malicious npm package opens backdoors on programmers- computers
author: PipisCrew
date: 2020-11-03
categories: [news]
toc: true
---

The npm security team has removed today a malicious JavaScript library from the npm website that contained malicious code for opening backdoors on programmers' computers.

https://www.zdnet.com/article/malicious-npm-package-opens-backdoors-on-programmers-computers/

origin - https://www.pipiscrew.com/2020/11/malicious-npm-package-opens-backdoors-on-programmers-computers/ malicious-npm-package-opens-backdoors-on-programmers-computers