FP & Scala: The Killer Combo for Machine Learning • Marek Kolodziej • YOW! 2015

Learn how Scala and functional programming can supercharge machine learning development with better performance, type safety, and scalability via key libraries and patterns.

Key takeaways
  • Machine learning is now ubiquitous across industries (fraud detection, spam filtering, NLP, recommender systems, speech recognition, self-driving cars)

  • Traditional data science tools (R, Python) have limitations:

    • Poor runtime performance
    • Lack of proper memory management
    • No referential transparency
    • Limited scalability
    • Imperative rather than functional approach
  • Scala advantages for machine learning:

    • Better mapping between math and implementation
    • Static typing helps catch errors early
    • First-class functions
    • Type inference
    • Implicit conversions
    • Supports both functional and object-oriented paradigms
    • Excellent scalability through Spark integration
  • Key Scala ML libraries:

    • Breeze for linear algebra and optimization
    • Epic and Puck for NLP
    • MLlib for Spark-based ML
    • Wisp/Lightning for plotting
    • Scala notebook for interactive development
  • Implementation benefits:

    • Same code can run on both local collections and distributed Spark
    • Clean functional implementations of algorithms
    • Less boilerplate compared to Java
    • Type safety while maintaining readability
    • Easier maintenance of large codebases
  • Adoption challenges can be overcome through:

    • Proper mentorship
    • Showing practical benefits
    • Demonstrating scalability advantages
    • Leveraging existing JVM ecosystem
    • Focusing on functional programming principles