Giter Club home page Giter Club logo

rscli's Introduction

Random Data Sampling CLI Tool (rscli)

Overview

rscli is a command-line tool written in Rust that samples lines from a delimited text file based on specified weights. It uses a heap-based approach to efficiently select random samples.

Features

  • Weighted Sampling: Selects lines from the input file based on provided weights.
  • Inclusion/Exclusion Filters: Allows filtering lines based on specified IDs.
  • Customizable Input: Supports specifying the input file, sample count, weight column, and more.
  • Logging: Utilizes the env_logger crate for configurable logging.

Usage

Installation

Ensure you have Rust installed. You can then build and install the rscli executable using the following commands:

git clone https://github.com/yourusername/rscli.git
cd rscli
cargo build --release

rscli [OPTIONS]

OPTIONS:
    --file <file>                      Input tree file
    --sample_count <sample_count>      The number of samples to get
    --weights <weights>                The column with the weights
    --include <include>                Include these rows - names by Id column
    --exclude <exclude>                Exclude these rows - names by Id column
    --id_col <id_col>                  Id column - default is the first one

rscli [OPTIONS] --file <FILE> --sample-count <SAMPLE_COUNT>

Example

# Sample 100 lines from input.txt with default settings
rscli --file input.txt --sample-count 100

# Sample 50 lines from input.txt with custom weight column and inclusion filter
rscli --file input.txt --sample-count 50 --weights my_weights --include id1,id2

# Sample 200 lines from data.csv excluding specific IDs
rscli --file data.csv --sample-count 200 --exclude id3,id4

rscli's People

Contributors

elforjani13 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.