F# Functional programming for data Sc "Data science seeks actionable and F consistent pattern for predictive uses. This F practical engineering goal takes data science le of in beyond traditional analytics. Now the data in those disciplines and applied fields that u lacked solid theories, like health F science and social science, could be sought of S! and utilized to generate powerful predictive models
F# Functional Programming for Data Science and AI • F# Functional programming to focus on function composition • F# Type provider to eliminate the barrier of including a source of information into a program • That is the need to represent that information as types, properties, and methods for use in a programming language environment. • Using F# Units of Measure helps prevent programming errors • F# Language Oriented Programming simplifies the integration of Symbolic AI Programming in .NET Platform. “Data science seeks actionable and consistent pattern for predictive uses. This practical engineering goal takes data science beyond traditional analytics. Now the data in those disciplines and applied fields that lacked solid theories, like health science and social science, could be sought and utilized to generate powerful predictive models
Modern features of ftt Type Inference First class functions Pattern Matching Object support
Modern Features of F# • Type Inference • First Class Functions • Pattern Matching • Object Support
Type Interence //name is inferred to be a string based on usage let printMessage name printf Hello there, %s! \n"name //'names' is inferred to be a sequence of strings let printNames names names Seq iter printMessage let names =["Ana;"Felipe;"Emillia printNames names
Type Inference // 'name' is inferred to be a string based on usage. let printMessage name = printfn "Hello there, %s!\n" name // 'names' is inferred to be a sequence of strings. let printNames names = names |> Seq.iter printMessage let names = [ "Ana"; "Felipe"; "Emillia" ] printNames names
First class functions let square x=X*X let isodd x=x%2<>0 let sumofoddSquares nums nums> List filter isodd> list. sum By square let numbers=[1; 2, 3 4; 5 let sum sumOfoddSquares numbers printf" The sum of the odd squares in %A is %d"numbers sum
First Class Functions let square x = x * x let isOdd x = x % 2 <> 0 let sumOfOddSquares nums = nums |> List.filter isOdd |> List.sumBy square let numbers = [1; 2; 3; 4; 5] let sum = sumOfOddSquares numbers printfn "The sum of the odd squares in %A is %d" numbers sum
Pattern Matching type Shape Square of side: double Rectangle of width: double length: double let getArea shape match shape with Square side-> side x side I Rectangle(width, length )-> width length let square= Square 2.0 printf"The area of the square is %f(getArea square)
Pattern Matching type Shape = | Square of side: double | Rectangle of width: double * length: double let getArea shape = match shape with | Square side -> side * side | Rectangle (width, length) -> width * length let square = Square 2.0 printfn "The area of the square is %f" (getArea square)