Options
All
  • Public
  • Public/Protected
  • All
Menu

DataBlock is an api which allows you to generate and manupilate your dataset. To be used in the Learner API

Hierarchy

  • DataBlock

Index

Constructors

constructor

Properties

batchSize

batchSize: number

client

client: any

datasetInfo

datasetInfo: IdatasetInfo

Optional ratingRange

ratingRange?: number[]

trainingDataset

trainingDataset: Dataset<any>

usersMovies

usersMovies: any

validationDataset

validationDataset: Dataset<any>

Methods

fromArray

  • fromArray(items: number[], users: number[], ratings: number[], options?: optionsDataBlockArray): Promise<DataBlock>
  • Create a datablock from a tensors. input the item, users, and ratings tensors

    Parameters

    • items: number[]
    • users: number[]
    • ratings: number[]
    • Optional options: optionsDataBlockArray

    Returns Promise<DataBlock>

fromCsv

  • fromCsv(path: string, options: optionsDataBlockCsv): Promise<DataBlock>
  • Create a datablock from a csv file. You should define the name of the columns which contain the corresponding data

    Parameters

    • path: string
    • options: optionsDataBlockCsv

    Returns Promise<DataBlock>

getInfoOnCsv

  • getInfoOnCsv(path: string, userColumn: string, itemColumn: string, delimiter: string): Promise<IdatasetInfo>
  • Get some stats about a csv file. mainly used in fromCsv method returns datasetInfo object

    Parameters

    • path: string
    • userColumn: string
    • itemColumn: string
    • delimiter: string

    Returns Promise<IdatasetInfo>

redisConfig

  • redisConfig(url: any): Promise<void>

save

  • save(outputFile: string, validationFileName?: string): Promise<void>
  • save the datablock in a path (training + validation). In case you wanted to save the validation data in different file, write the validation file name in the second argument "validationFileName"

    Parameters

    • outputFile: string
    • Optional validationFileName: string

    Returns Promise<void>

size

  • size(): number
  • return the size of the dataset (training + validation)

    Returns number

splitTrainValidTensor

  • splitTrainValidTensor(items: number[], users: number[], ratings: number[], validationPercentage: number): void
  • Split the tensors into training and validation set. mainly used in fromTensor method

    Parameters

    • items: number[]
    • users: number[]
    • ratings: number[]
    • validationPercentage: number

    Returns void

Generated using TypeDoc