About the Part 2 (2019) category

looks like it’s going to be included in part 2 starting soon!

if you want to be part of making this happen, be sure to join the upcoming class, either in person at the University of San Francisco, or in the next part 2 MOOC (coming out June 2019).

1 Like

Thank you Jeremy for the invitation. Feels like an honor. :slight_smile:
As I’ll be starting my sabbatical soon, I pledge to contribute more this time.

Oh what a happy day. Thank you so much for including us.

On Swift For TensorFlow and FastAI, I am also interested in what’s brewing…

So just chime in and a bit…

I learnt Swift in order to switch away from objective c (for iOS dev), and I really like the language. I just never guess it may soon join the high perf numeric and DL dev, and some of the features would make even a Ruby programmer happy.

For now, some of the TF API names look a bit long and clumsy. But Swift let you define your own domain specific “sub-lang”, e.g. you can write this if you want:

let square = { (x: Int) in Double(x*x) }

let sum = ∑^{0..<4} ∘ square

// sum = 0^2 + 1^2 + 2^2 + 3^2

where square is a closure/func, and ∑^ is a prefix operator. And this:

let π = Double.pi
let trig_sum = ∑^{0..<100}∘{ sin($0 * π/4.0) }    // \sum^0_100 \sin(iπ/4) in TeX
trig_sum

This is almost something you can translate into LaTeX and imported into your paper!

If you love this, I can post more out in a gist and it is a good motivation to learn Swift. I am looking forward to seeing this kind of syntax used in FastAI.

Update: Here’s the gist. I just realized this may be on older version of swift, but i think it should still work. You can try create a google colab notebook for swift, and paste the code in a single cell. For that, you need to open an pre-existing one available in S4TF page on colab and copy it into your google drive and edit it. If you are mac dev, you know what to do.

Update 2: Google colab for swift has bug surrounding operator implementation. It only works if you keep all your code in the scope of a single cell. I will try to file a bug for this.

Here is the colab notebook (with highlighting the bug):

2 Likes

I posted this link in the harebrain forum, but you might enjoy watching this too: https://www.dotconferences.com/2019/01/jeff-biggus-scientific-swift

Will these lessons be recorded or do we need to watch them in real time? They’re a little late in the night for me…

This is great. Thanks for sharing, will check your post out. I think this should get wider attention, esp. swift has been open source and now we have tensorflow. I have been playing around with this sort of thing for a while but just thought no one outside Apple community would care. Also, not sure if u check out Jeremy’s BaseMath post? I took his code and extended it to use Accelerate instead of pure C. It was a nice example of protocol oriented programming applying to high perf compute. But he used DSL or functional programming very sparingly… and the syntax is still not perfectly exactly math friendly and borrowed from Pytorch. I will post the git repos when I have time, it is still just a personal Xcode project right now.

Let see what fastai will look like in swift. I will ping you to see if you are interesting in collaborating with something. The snippet above is in my gist, just need to dig up the link, and will post shortly.

I’m having trouble finding the links to work through Part 1v3 ahead of Part2v3.

Is there a full index for part 1v3 like there was for part1 v2? Lesson Index

Thanks!

Thanks for the invitation, Jeremy. Eventually i have some spare time, so looking forward to your new course and new technology.

Thanks a lot Jeremy for the invitation!

So do we need to do anything to actually register ? Or should we just wait and see ?

1 Like

I checked our your link and slide, they looked awesome, and I learned a few more things in the process. also, check out “structure and interpretation of classical mechanics”. This is computational CM done in functional manner. I thought what they did there (in lisp/scheme), could be “modernized” with swift, and run much faster. (this is not entirely irrelevant, CM is cast to be an optimization problem there).

If none exists, maybe a separate discussion thread can be created for anyone who like to discuss more about this topic, and avoid poluting this thread.

1 Like

Thank you for the invitation @jeremy! Excited about the new version of Part 2, looking forward to the course and contributing to the forums.

This is the playlist for Part 1v3?

1 Like

How to do you even type something like sigma

Thanks for your interest. Yes, this can be a drawback to this fancy way.

  • alt-224 shortcut, pls google to confirm
  • Int’l keyboard set to Greek
  • whatever OS u use and GUI way of inputting Unicode,
  • depending on IDE, maybe autocomplete? (Never tried)
  • from wolfram alpha special “math keyboard”
  • good old cut and paste

Your mathematical code is written once but read many many times by you and others. I feel it is an still ok trade off.

1 Like

Thanks a lot Jeremy. I was really looking forward for Part 2. Very happy to get selected. Can’t wait to go through the journey of fastai library creation from scratch. Super excited!!!

Another way is using RFC 1345 style input in your IDE; e.g. with Vim digraphs or Emacs rfc1345 input method . This maps many Unicode symbols to pairs of characters like ‘S*’ for ∑ (Sigma) and ‘Ob’ for ∘ (Ring Operator); here’s a chart of the characters.

However I’m not sure there’s any advantage of the prefix operator over a Sum function, and there are some disadvantages of Unicode in code - not everyone knows how to type it, it won’t render in many fonts, not everyone has a mathematical background to know how to read it, and it’s not always clear what symbol it is - is it Greek Capital Sigma Σ U+03A2 or N-ary summation ∑ U+2211; I presume it’s not Latin Capital Esh Ʃ U+01A9.

well, any function need (), and i like to omit it in the example i showed. it looks too ugly for what i want to express. but i agree with u unicode may hinder some folks. but i think adjusting to functional programming may be a bigger hurdle also.

i think if you like math as it is written in papers and textbook, you will likely love that representation in code as well. this sort of sugar syntax is best added on top of full set API, so you can always fall back on english verbosity if desired. I think S4TF is leaving this all out knowing they are highly customizable and can be easily done in “user space”.

In Julia entering math symbols can be done by typing the LaTeX name for the symbol. I like that because it feels very natural.
https://docs.julialang.org/en/v1/manual/variables/index.html

Just wanted to confirm that from tomorrow the class will start?