Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tensorflow-load-csv

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tensorflow-load-csv

Create tensors directly from CSV files. Supports operations like standardisation so you can dive right into the fun parts of ML.

  • 1.4.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

tensorflow-load-csv

License: MIT TypeScript code style: prettier

workflows

A library that aims to remove the overhead of creating tensors from CSV files completely; allowing you to dive right into the fun parts of your ML project.

  • Lightweight.
  • Fast.
  • Flexible.
  • TypeScript compatible.
  • 100% test coverage.

Documentation

You can find the docs here.

Installation

NPM:

npm install tensorflow-load-csv

Yarn:

yarn add tensorflow-load-csv

Usage

Simple usage:

import loadCsv from 'tensorflow-load-csv';

const { features, labels } = loadCsv('./data.csv', {
  featureColumns: ['lat', 'lng', 'height'],
  labelColumns: ['temperature'],
});

features.print();
labels.print();

Advanced usage:

import loadCsv from 'tensorflow-load-csv';

const {
  features,
  labels,
  testFeatures,
  testLabels,
  mean, // tensor holding mean of features, ignores testFeatures
  variance, // tensor holding variance of features, ignores testFeatures
} = loadCsv('./data.csv', {
  featureColumns: ['lat', 'lng', 'height'],
  labelColumns: ['temperature'],
  mappings: {
    height: (ft) => ft * 0.3048, // feet to meters
    temperature: (f) => (f - 32) / 1.8, // fahrenheit to celsius
  }, // Map values based on which column they are in before they are loaded into tensors.
  shuffle: true, // Pass true to shuffle with a fixed seed, or a string to use it as a seed for the shuffling.
  splitTest: true, // Splits your data in half. You can also provide a certain row count for the test data, or a percentage string (e.g. 10%).
  prependOnes: true, // Prepends a column of 1s to your features and testFeatures tensors, useful for linear regression.
  standardise: true, // Calculates mean and variance for each feature column using data only in features, then standardises the values in features and testFeatures. Does not touch labels.
});

features.print();
labels.print();

testFeatures.print();
testLabels.print();

mean.print();
variance.print();

Keywords

FAQs

Package last updated on 23 Feb 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc