Skip to content

Commit

Permalink
fix: add parameter in RegressionResult
Browse files Browse the repository at this point in the history
  • Loading branch information
mrleidesen committed Aug 29, 2022
1 parent a31f739 commit 388f382
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions src/ecStat.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,28 @@ declare namespace EChartsStat {
function kMeans(data: InputData, clusterNumer: number): Result
}

interface RegressionResult {
interface RegressionParameter {
linear: {
gradient: number
intercept: number
}
exponential: {
coefficient: number
index: number
}
logarithmic: {
gradient: number
intercept: number
}
polynomial: any[]
}

interface RegressionResult<T extends keyof RegressionParameter> {
points: OutputData
expression: string
gradient: number
intercept: number
parameter: RegressionParameter[T]
}
function regression(regreMethod: 'linear' | 'exponential' | 'logarithmic' | 'polynomial', data: InputData, order: number): RegressionResult
function regression(regreMethod: keyof RegressionParameter, data: InputData, order: number): RegressionResult<regreMethod>

namespace statistics {
function deviation(data: Array<number>): number
Expand Down

0 comments on commit 388f382

Please sign in to comment.