SkillAgentSearch skills...

Ktrain

ktrain is a Python library that makes deep learning and AI more accessible and easier to apply

Install / Use

/learn @amaiya/Ktrain

README

Overview | Tutorials | Examples | Installation | FAQ | API Docs | How to Cite

PyPI Status ktrain python compatibility license Downloads

<!--[![Twitter URL](https://img.shields.io/twitter/url/https/twitter.com/ktrain_ai.svg?style=social&label=Follow%20%40ktrain_ai)](https://twitter.com/ktrain_ai)--> <p align="center"> <img src="https://github.com/amaiya/ktrain/raw/master/ktrain_logo_200x100.png" width="200"/> </p>

Welcome to ktrain

a "Swiss Army knife" for machine learning

News and Announcements

  • 2024-02-20
    • ktrain 0.41.x is released and removes the ktrain.text.qa.generative_qa module. Our OnPrem.LLM package should be used for Generative Question-Answering tasks. See example notebook.

Overview

ktrain is a lightweight wrapper for the deep learning library TensorFlow Keras (and other libraries) to help build, train, and deploy neural networks and other machine learning models. Inspired by ML framework extensions like fastai and ludwig, ktrain is designed to make deep learning and AI more accessible and easier to apply for both newcomers and experienced practitioners. With only a few lines of code, ktrain allows you to easily and quickly:

  • employ fast, accurate, and easy-to-use pre-canned models for text, vision, graph, and tabular data:

    • text data:
      • Text Classification: BERT, DistilBERT, NBSVM, fastText, and other models <sub><sup>[example notebook]</sup></sub>
      • Text Regression: BERT, DistilBERT, Embedding-based linear text regression, fastText, and other models <sub><sup>[example notebook]</sup></sub>
      • Sequence Labeling (NER): Bidirectional LSTM with optional CRF layer and various embedding schemes such as pretrained BERT and fasttext word embeddings and character embeddings <sub><sup>[example notebook]</sup></sub>
      • Ready-to-Use NER models for English, Chinese, and Russian with no training required <sub><sup>[example notebook]</sup></sub>
      • Sentence Pair Classification for tasks like paraphrase detection <sub><sup>[example notebook]</sup></sub>
      • Unsupervised Topic Modeling with LDA <sub><sup>[example notebook]</sup></sub>
      • Document Similarity with One-Class Learning: given some documents of interest, find and score new documents that are thematically similar to them using One-Class Text Classification <sub><sup>[example notebook]</sup></sub>
      • Document Recommendation Engines and Semantic Searches: given a text snippet from a sample document, recommend documents that are semantically-related from a larger corpus <sub><sup>[example notebook]</sup></sub>
      • Text Summarization: summarize long documents - no training required <sub><sup>[example notebook]</sup></sub>
      • Extractive Question-Answering: ask a large text corpus questions and receive exact answers using BERT <sub><sup>[example notebook]</sup></sub>
      • Generative Question-Answering: ask a large text corpus questions and receive answers with citations using local or OpenAI models <sub><sup>[example notebook]</sup></sub>
      • Easy-to-Use Built-In Search Engine: perform keyword searches on large collections of documents <sub><sup>[example notebook]</sup></sub>
      • Zero-Shot Learning: classify documents into user-provided topics without training examples <sub><sup>[example notebook]</sup></sub>
      • Language Translation: translate text from one language to another <sub><sup>[example notebook]</sup></sub>
      • Text Extraction: Extract text from PDFs, Word documents, etc. <sub><sup>[example notebook]</sup></sub>
      • Speech Transcription: Extract text from audio files <sub><sup>[example notebook]</sup></sub>
      • Universal Information Extraction: extract any kind of information from documents by simply phrasing it in the form of a question <sub><sup>[example notebook]</sup></sub>
      • Keyphrase Extraction: extract keywords from documents <sub><sup>[example notebook]</sup></sub>
      • Sentiment Analysis: easy-to-use wrapper to pretrained sentiment analysis <sub><sup>[example notebook]</sup>
      • Generative AI with GPT: Provide instructions to a lightweight ChatGPT-like model running on your own own machine to solve various tasks. <sub><sup>[example notebook]</sup>
    • vision data:
    • graph data:
    • tabular data:
      • tabular classification (e.g., Titanic survival prediction) <sub><sup>[example notebook]</sup></sub>
      • tabular regression (e.g., predicting house prices) <sub><sup>[example notebook]</sup></sub>
      • causal inference using meta-learners <sub><sup>[example notebook]</sup></sub>
  • estimate an optimal learning rate for your model given your data using a Learnin

View on GitHub
GitHub Stars1.3k
CategoryEducation
Updated15d ago
Forks260

Languages

Jupyter Notebook

Security Score

100/100

Audited on Mar 16, 2026

No findings