Giter VIP home page Giter VIP logo

digit-display-csharp-comparison's Introduction

digit-display-csharp

Naive hand-written digit recognition with display applications to show image, prediction, and errors.

This is a C# version of a project originally written in .NET (F# & C#). Details of that project are available here: https://github.com/jeremybytes/digit-display.

This is primarily used to compare performance and other environment features with similar projects in Go (golang) and Rust (rust-lang).

Functions

  • Reading files from the file system
  • Training simple nearest-neighbor digit recognizers
    • Manhattan distance
    • Euclidean distance
  • Output (pretty bad) ASCII art
  • Multi-threading
  • Channels
  • Chunking / threading
  • Parsing command-line parameters

Usage

PS C:\...> .\digits.exe --help
digits 1.0.0
Copyright (C) 2022 digits

  -o, --offset     (Default: 1000) Offset in the data set (default: 1000)
  -c, --count      (Default: 100) Number of records to process (default: 100)
  --classifier     (Default: euclidean) Classifier to use (default: 'euclidean')
  -t, --threads    (Default: 6) Number of threads to use (default: 6)
  --help           Display this help screen.
  --version        Display version information.

Notes
This project was originally the slowest of the 3 (see https://github.com/jeremybytes/digit-display-language-comparison for comparison).

Based on community input, the following performance updates were made (details will be written up in articles soon):

  • List<int> changed to int[]
  • String concatenation changed from string+= to using StringBuilder
  • Abstract override method was moved out of a tight loop to a higher level. This results in duplicated code but a very large change in performance.

These resulted in significant performance improvements. The first 2 changes resulted in run times that are 30% faster (from 20 seconds to 14 seconds for a specific run). All 3 changes together resulted in run times that are 75% faster (from 20 seconds to 5 seconds).

Branches
The original and updated code are available in separate branches for comparison purposes.

  • original - includes the orginal code
  • perftest1 - contains the array and string builder changes
  • perftest2 - contains the abstract method changes

Specifics on these changes will be detailed soon.

digit-display-csharp-comparison's People

Contributors

jeremybytes avatar

Stargazers

Eduardo Cáceres avatar Elan Hasson avatar frankfanslc avatar

Watchers

James Cloos avatar  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.