Git Product home page Git Product logo

knn-classification's Introduction

knn-classification

knn text classification

#通过tfidf计算文本相似度,从而预测问句所属类别

#实现过程

#1.根据训练语料(标签\t问句),进行分词,获得(标签\t标签分词\t问句\t问句分词)

#2.根据输入的训练语料分词结果,产生ngram和skipgram的特征,基于此生成tfidf模型

#3.对于测试集,进行分词,获取测试问句的tfidf表征,计算训练语料中与其最相似的topn问句,根据topn问句的标签来预测测试问句的标签

#准备训练语料:

#python get_knn_input.py

#训练过程:

#python knn_classification.py --model_version=knn_model_v3 --is_train=true --input_file=./data/cnews.train.knn_seg

#测试过程:

#python knn_classification.py --model_version=knn_model_v3 --is_train=false --input_file=./data/cnews.test.knn_seg

knn-classification's People

Contributors

weiyujian 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.