<commit_before># loess

JavaScript implementation of the Locally-Weighted Regression package originally written in C by Cleveland, Grosse and Shyu (1992)

## Getting started

First install the package:
```
npm install loess --save
```

Load in your data:
```javascript
var data = require('./myData.json')
```

Instantiate a LOESS model with the data:
```javascript
var Loess = require('loess')
var options = {span: 0.5, band: 0.8, degree: 1}
var model = new Loess(data, options)
```

Fit model by calling the **.predict( )** method on the model object:
```javascript
var fit = model.predict()
console.log(fit.fitted)
// do something else with fit.fitted
```

To fit model on a new set of points, pass a data object into **.predict( )**
```javascript
var newData = {
  x: [1, 2, 3, 4, 5],
  x2: [6, 7, 8, 9, 10]
}

fit = model.predict(newData)

var upperLimit = fit.fitted.map((yhat, idx) => yhat + fit.halfwidth[idx])
var lowerLimit = fit.fitted.map((yhat, idx) => yhat - fit.halfwidth[idx])
// plot upperLimit and lowerLimit
```

Alternatively, use **.grid( )** method to generate a grid of equally spaced points:
```javascript
newData = model.grid([20, 20])

fit = model.predict(newData)
```

***

## Usage

![screenshot1](./img/screenshot1.png)

![screenshot2](./img/screenshot2.png)

#### Find out more by visiting my demo app: <br>
[https://loess.daburu.xyz/](https://loess.daburu.xyz/)

***<commit_msg>Update demo page<commit_after># loess

JavaScript implementation of the Locally-Weighted Regression package originally written in C by Cleveland, Grosse and Shyu (1992)

## Getting started

First install the package:
```
npm install loess --save
```

Load in your data:
```javascript
var data = require('./myData.json')
```

Instantiate a LOESS model with the data:
```javascript
var Loess = require('loess')
var options = {span: 0.5, band: 0.8, degree: 1}
var model = new Loess(data, options)
```

Fit model by calling the **.predict( )** method on the model object:
```javascript
var fit = model.predict()
console.log(fit.fitted)
// do something else with fit.fitted
```

To fit model on a new set of points, pass a data object into **.predict( )**
```javascript
var newData = {
  x: [1, 2, 3, 4, 5],
  x2: [6, 7, 8, 9, 10]
}

fit = model.predict(newData)

var upperLimit = fit.fitted.map((yhat, idx) => yhat + fit.halfwidth[idx])
var lowerLimit = fit.fitted.map((yhat, idx) => yhat - fit.halfwidth[idx])
// plot upperLimit and lowerLimit
```

Alternatively, use **.grid( )** method to generate a grid of equally spaced points:
```javascript
newData = model.grid([20, 20])

fit = model.predict(newData)
```

***

## Usage

![screenshot1](./img/screenshot1.png)

![screenshot2](./img/screenshot2.png)

#### Find out more by visiting my demo app: <br>
[https://loess.netlify.com/](https://loess.netlify.com/)

***
{'fraction_non_alphanumeric': 0.16022686990428925, 'fraction_numerical': 0.02056008507621411, 'mean_word_length': 4.354838709677419, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6450935', 'n_tokens_mistral': 1039, 'n_tokens_neox': 954, 'n_words': 324}