Snippets created by Faisal Waris

  • Twitter Stream API

    Twitter now provides a streaming API which can be used to obtain a continuous stream of tweets on any set of topics, locations, etc., in real time. Read the full details here. It would be nice to convert this stream into an F# sequence so that it can be treated just as any other sequence if F#. This provides “composability”; separation of the generation of a sequence from its consumption. Here is a snippet that does that.

    12 people like this

    Posted: 11 years ago by Faisal Waris

  • Twitter OAuth

    Generates the value string for the "Authorization:" header given Twitter application/user keys and tokens and the parameters for the request being authorized.

    0 people like this

    Posted: 10 years ago by Faisal Waris

  • Porter Stemmer

    An Implementation of the Porter Stemming Algorithm in F# for text analysis. Please see: http://tartarus.org/martin/PorterStemmer/

    3 people like this

    Posted: 10 years ago by Faisal Waris

  • Gantt Chart Visualization

    Shows how to generate a Gantt chart to visualize a schedule. Note: Requires BinPacking.fs found here: http://fssnip.net/hG

    3 people like this

    Posted: 10 years ago by Faisal Waris

  • Amazon S3 API

    Partial wrapper for Amazon S3 for both the Web and SOAP APIs. Generates signatures for both APIs (which was the tricky part). Uses WSDL Type Provider for SOAP. Uses SOAP for bucket list and delete operations and WebAPI to upload/download object contents (streamed / async)

    4 people like this

    Posted: 9 years ago by Faisal Waris

  • Tiny Logging Module

    High performance asynchronous Logging module with time-based rollover and size-based file retention in under a 100 lines of F# Bug fix: Fixed log file name date time from "yyyyMMddhhmm" to yyyyMMddHHmm" (24 hour clock)

    6 people like this

    Posted: 9 years ago by Faisal Waris

  • Alternative Actor Implementation for Android

    Actor implementation (much simplified) intended for use on mobile devices. Seems to provide better memory usage behavior than native F# Mailbox Processors (MPB) (on Android). Though is not as 'smooth' as native F# MBP. Smoothness here refers to how processing is balanced between consumers and producers (most relevant to single core machines).

    8 people like this

    Posted: 9 years ago by Faisal Waris

  • xorshift128plus PRNG that mimics System.Random

    Faster with much better quality random numbers than System.Random. See https://en.wikipedia.org/wiki/Xorshift

    0 people like this

    Posted: 6 years ago by Faisal Waris

  • Observable Agent

    Extension to Control.Observable module to create an Observable linked to a MailboxProcessor. Messages posted to the mailbox are published to subscribers. Requires a cancelation token which when cancelled sends OnComplete to subscribers. Only the Post method is exposed from the internally created MailboxProcessor.

    2 people like this

    Posted: 6 years ago by Faisal Waris

  • Live chart of CNTK Error Rate

    CNTK is Microsoft's deep learning toolkit. This snippets allows one to view the live error rate on a chart. It relies on FSharp.Charting and FSharp.Control.Reactive and a couple of other F# snippets the links for which are referenced in the code. Use 'track' function to start viewing live charts.

    1 people like this

    Posted: 6 years ago by Faisal Waris

  • Frequent Pattern Growth algorithm

    This is a commonly used algorithm for 'market basket' type analysis. It finds frequent itemsets from a series of transactions. Frequent itemsets are the item combinations that are frequently purchased together. See usage comment for example

    0 people like this

    Posted: 4 years ago by Faisal Waris

  • Sentiment Classification and Cross-Validation with ML.Net - Sample - Using Anonymous Records

    ML.Net sentiment classification and cross-validation example using Gradient Boosted trees Needs to be compiled in a dotnet core F# project. Uses F# 4.6 anonymous records which work well with the ML.Net API static api

    2 people like this

    Posted: 4 years ago by Faisal Waris

  • Csv Type Provider Schema Parser

    Parses the schema string format used by the CSV Type Provider from the FSharp.Data library ...because sometimes you need the metadata. Support for names with underscore

    5 people like this

    Posted: 4 years ago by Faisal Waris

  • Minimal AutoML Binary Classification Sample

    Shows how to use ML.Net AutoML capability for binary classification. Now with progress reporting

    2 people like this

    Posted: 3 years ago by Faisal Waris

  • Useful operator definition for interop with C#

    invokes op_Implicit when applied (for implicit conversions). I have found this to be very convenient when using C# libraries

    6 people like this

    Posted: 2 years ago by Faisal Waris

  • Configure F# Interactive to use Microsoft.ML.Net

    Updated to use the new "nuget:..." style references. At this time a workaround is needed to properly load some of the native libraries.

    1 people like this

    Posted: 2 years ago by Faisal Waris

  • Bayesian Inference with Infer.Net: M&M problem

    Solve a sample problem from the book "Think Bayes" by Allen B. Downey. Shows how the problem can be modeled with Infer.Net and also provide the manual solution as presented in the book. The code relies on the Infer.Net "FSharpWrapper" project which is not included in the nuget package (as of now).

    4 people like this

    Posted: 1 year ago by Faisal Waris

  • Max Flow - push-relabel algorithm

    Push-relabel algorithm for Max Flow problems in flow graphs. (Does not check if graph has improper back edges)

    3 people like this

    Posted: 1 year ago by Faisal Waris

  • groupAdjacent

    A variation of another snippet "Seq.groupWhen". This one groups adjacent elements based on a predicate that accepts two arguments - the previous and current elements

    2 people like this

    Posted: 2 months ago by Faisal Waris