62
u/Hcmichael21 Mar 30 '18
Big if true
44
u/TheLastMonster Mar 30 '18
if(true) big();
36
u/Knext Mar 30 '18
ReferenceError: big is not defined11
u/Combinatorilliance Mar 30 '18
(function (isTrue) {if (isTrue) console.log("Big");}(true));8
Mar 30 '18
console.log((arg => (a => b => c => a(b)(c))(arg)('Big')('Small'))(a => b => a))2
u/spel3o Mar 31 '18
console.log((arg => (a => b => c => a(b)(c))(arg)('Big')('Small'))(a => b => a))
No joke, doing beta reduction on this comment has given me the best intuition to date as to why (a => b => a) represents "True" in lambda calculus.
3
u/NomNomDePlume for (;;); Mar 30 '18
if(",,"==new Array(3)){var z=[66];z.push(z[0]+39),z.push(z[1]-2),z.forEach(r=>{console.log(String.fromCharCode(r))})}3
Mar 31 '18
[removed] — view removed comment
5
u/AreYouDeaf Mar 31 '18
CONSOLE.LOG((ARG = (A = B = C = A(B)(C))(ARG)('BIG')('SMALL'))(A = B = A))
1
1
2
u/sad__frog Mar 31 '18
You need to interpret it backwards, then once in French and twice in Deutschland
4
-3
7
1
1
1
101
u/CiezkiBorsuk Mar 30 '18
we are actively working on creating node.js bindings to the TensorFlow C API
This makes me so happy, because when they are done I lose the last reason to ever use Python in my life ^-^
30
u/2Punx2Furious Mar 30 '18
You don't like Python?
75
u/gavrocheBxN Mar 30 '18
I like Python but I love TypeScript
6
u/SamSlate Mar 30 '18
what can you do with type you can't with vanilla? (serious question)
82
u/aaaqqq Mar 30 '18
refactor large code bases with impunity
1
u/ProcrastinatingNow Mar 30 '18
You could technically do that with flow. But seeing as you have transpile whether you use flow or TS, I guess it’s down to preference.
Edit: actually I forgot that flow supports type hints in comments. So you might be able to get away with vanilla JS but static type analysis.
14
u/aaaqqq Mar 30 '18
I was responding to ts vs vanilla not ts vs flow. Flow is good (that's what I use at work) but its tooling sucks.
TS also supports type hints via jsdocs. But then if you're using comments/jsdocs to add types, why not just use TS/Flow
5
Mar 30 '18
Doesn’t typescript have the ability to read jsdoc style comments as well? Thought I remembered hearing that on a podcast a while back
1
3
u/sethetter_ Mar 31 '18
Personally, the choice of TypeScript over Flow is mostly due to a more developed community, better tooling, more consistently defined types across many open source libraries, etc. Flow is amazing, but tooling and community are incredibly important.
5
u/SahinK Mar 31 '18
Amazing intellisense. Autocompletions for everything. No need to keep checking documentation or stackoverflow to find out what methods are available to you or what arguments to pass to an API. No easily avoidable runtime errors. Much easier to read and understand other people's code.
I would never go back to plain JavaScript.
1
6
u/2Punx2Furious Mar 30 '18
Nothing really, as far as I know TypeScript just compiles to regular JavaScript.
It just has some helpful features to make your life easier.
29
u/calsosta Mar 30 '18
Why do you want an easy life?
4
u/2Punx2Furious Mar 30 '18
Life is hard enough as it is.
I like some challenge, but I value time more.
2
u/fizzy_tom Mar 30 '18
What value does time give you?
1
u/2Punx2Furious Mar 30 '18
I'd say everything.
Everything I can do takes some time, it is a limited, valuable, and probably non-renewable resource.
4
1
u/LordDrakota Apr 05 '18
I like an easy life, but it seems that using TS in React is a huge time sink to just set up everything with Redux, Redux-thunk and company. This is holding me back to just use TS all the time.
3
u/CiezkiBorsuk Mar 30 '18
what can you do with vanilla that you can't do with TS?
43
1
u/Velfi Mar 31 '18
"1" + 2 == "12"
1
u/CiezkiBorsuk Mar 31 '18
If you really care about this use case, sleep sound: this is perfectly valid TS.
0
Mar 30 '18
[deleted]
4
u/SamSlate Mar 30 '18
weird, I've never had an issue with js' loose types, but i hear a lot of criticism for js on the type system..
8
u/CiezkiBorsuk Mar 30 '18 edited Mar 30 '18
No, I don't. I find it really hard to read code with minimal punctuation.
It was easier to learn than most languages because of that, but once I know something else, I really see no reason to use Py, unless I have to.
4
u/nickguletskii200 Mar 30 '18 edited Mar 30 '18
No, I don't. Code without types is unreadable because it requires me to remember the flow of information. I would really love to use TensorFlow from Scala, Java, C# or TypeScript. Ideally, there would be a language for machine learning that does compile-time dimension checks (you can probably do something like that with templates in C++, but package management isn't a thing in the world of C++).
Just try reading some of the code in the research TensorFlow models. It sucks. Not because the concepts behind it are hard, but because a ton of information is hidden.
Also, Python's lack of a strict project structure is very annoying. I can take any modern JVM project and it will follow a strict hierarchy, with a proper, unified place for dependencies (Maven POM, Gradle build file or SBT build definition), while even big companies such as Google don't set up the Python projects consistently.
EDIT: Also, fuck the lack of punctuation. Goddamn Google and their 2-space tabs, so infuriating! I just want my auto-indent!
2
u/raiderrobert Mar 30 '18
Python 3.6 has type annotations: https://docs.python.org/3/library/typing.html
But I admit that project organization has room for improvement.
3
u/Jugad Mar 30 '18
I am not sure if project organization belongs in the language, specially since projects can be so different... a web project directory structure has very little in common with an ML project, or a desktop GUI project (yes, I make desktop GUI programs using wxPython).
If you are talking at a very high level ... directories like src, test, documentation, build, etc at the top level, maybe that makes some sense. But I wonder how much does it actually help.
1
u/nickguletskii200 Mar 30 '18 edited Mar 30 '18
I know about the type annotations. The problem is that pretty much nobody else uses them, and they don't seem to be very expressive.
2
u/raiderrobert Mar 30 '18
Could you elaborate on the expressiveness part. I've used C#, C, and Rust before. If any of those help explain what you mean, that would be great.
1
u/nickguletskii200 Mar 31 '18
I am sorry, I was very tired yesterday and didn't clarify that it's not the typing package's fault.
The problem is that due to the "Pythonic way" most developers don't write code with types in mind, which means that it's impossible to require that something is something (i.e. it implements an interface). For instance, try requiring something to be the equivalent of ICloseable in C# using typing. You'd have to create an ABC (bleh) for that, and good luck forcing every Python user to describe the capabilities this way.
typingitself seems pretty OK.2
u/Jugad Mar 30 '18
The problem is that pretty much nobody else uses them
I thought every typed language uses them... I know this might come across as snarky, but seriously, can you explain what's the basic difference between type annotations/information in Python and, say, Java?
they don't seem to be very expressive
Why are they not expressive?
1
u/nickguletskii200 Mar 31 '18
I thought every typed language uses them... I know this might come across as snarky, but seriously, can you explain what's the basic difference between type annotations/information in Python and, say, Java?
It's not that there is a difference. It's just that Python developers don't write code with typings in mind. In Java and C# everyone makes a best effort to describe the contract using interfaces. In Python, everyone just writes classes with the same methods, and you can't really say "I want something that is Closeable" because nobody specifies that their class is Closeable.
That's why I don't think type annotations are expressive - they can be, it's just that in practice, they are not. In the end, you'll be writing things like
Union[Dog, Cat, Rabbit]instead ofis Pettablebecause Python programmers would just say that all these things extend an Animal and be done with it.2
u/antespo Mar 30 '18
I guess if your mainly a js developer then having to jump to python for tensorflow could be alittle annoying. I mainly use python and js secondary so I may be biased but I think if you wanna use tensorflow python is the way to go, at least for now. Regardless I am looking forward to using tensorflow in js.
5
u/2Punx2Furious Mar 30 '18
I get it.
I mainly use JS/TypeScript, but I also really like Python, even if it's been a while since last time I used it, switching back and forth between languages can be annoying.
1
21
u/PaperCow Mar 30 '18
This is very cool. I've been wanting to mess with ML for a while but never really found the time to do it. I work with JS but haven't touched python in years so this will make it a lot easier to get my feet wet.
Also I spent way too long playing pacman with my head. That's just awesome.
3
u/rwieruch Mar 30 '18
This announcement is just great! If you are interested in using JS in ML, checkout this one. Still have to put Tensorflow.js in there now :)
14
u/mehulmpt Mar 30 '18
AWESOME! JS is my primary language for programming most of the things. And tensorflow coming to JS is great news for JS devs!
15
5
u/yarauuta Mar 30 '18 edited Mar 30 '18
Node.js is going to be #1. Python is doomed.
Edit: calm down lol, ofc it may take years.
24
Mar 30 '18
Calm down.. JS doesn't have 1/10 of 1% of the scientific ecosystem that Python has.
9
u/L43 Mar 30 '18
Apparently best not say that in /r/javascript... no matter how true it is. When javascript has its own numpy, maybe. Until then, no.
2
u/calligraphic-io Mar 30 '18
WhenJavascript has its own numpy.Fixed that for you.
8
u/L43 Mar 30 '18
I've seen and tried out this library, and I do really like it: it certainly makes doing simple things easier than writing in plain javascript. But it isn't anything close to numpy. It
Doesn't have anywhere near the functionality that numpy has (e.g. no eigendecompositions from what I can see)
Doesn't have multiple dedicated developers with many companies and a foundation funding its development
It's data structures and api aren't used and emulated by a much larger javascript scientific ecosystem.
Isn't battletested by years of use.
That is what I was really referring to by 'having a numpy'. Honestly, I don't think the Javascript community is capable of 'having a numpy', it fragments too quickly as people jump to make their own version of a library, with trendier names and prettier documentation. I don't mean that as an insult, the ingenuity and raw speed of development of js libraries is incredible. But scientists work differently to developers, and they don't care for new and shiny, they like reliable and venerable. This is why Python is a good match for science.
I'd love to be proven wrong, the unique strength to visualize your work with the dom is enough to make JS attractive.
1
2
u/calligraphic-io Mar 30 '18
JS doesn't have 1/10 of 1% of the scientific ecosystem that Python has
That is demonstrably untrue, and 73.6% of all statistics are made up anyway. NumJS doesn't have feature parity with NumPy, same as SciJS and SciPy, but they're not that far apart either. SciJS has optimization, linear algebra, integration, interpolation, fast Fourier transforms, signal processing, image processing, ODE solvers, and more.
With Node Tensorflow bindings, it's probably not long before we see robust neural network libraries built over it in JS like Keras.
4
Mar 30 '18
I must confess, that was 100% made up. JS is still very far from Python, but it's cool that it's making good progress.
1
Mar 30 '18
Even tho we need to calm down, I am very happy with this news. Tensorflow native bindings are a great step. With the new eager execution improvements, it will cover a lot of what is needed for fast matrix manipulation in JS.
-2
8
u/cupcake0 Mar 30 '18
I’m gonna have to disagree with you on that. I’m primarily a JS developer, however JS doesn’t even come close when it comes to scientific computation or ML. Check out NumPy, SciPy, and Keras. I don’t see that changing anytime soon, but I’m glad to see that TensorFlow is coming for node.
4
u/theDigitalNinja Mar 30 '18
None of the example code works. I'm getting a 404 from github https://github.com/tensorflow/tfjs-examples
7
3
u/icharxo VanillaJS Mar 30 '18 edited Mar 30 '18
we are actively working on creating node.js bindings to the TensorFlow C API
Where does this leave PropelML, I wonder. PropelML already has that, though, not sure how much of the API is already covered. Sounds like they are both trying to do the same thing, which is weird considering that PropelML uses deeplearn.js for in-browser stuff.
2
u/Mittalmailbox Mar 30 '18 edited Mar 30 '18
This is really great. Will this have full API as Python. In Golang I always hear use Putin Python for training and Golang for execution.
13
u/pomlife Mar 30 '18
Use Putin for training
Looks like another Russian shill got exposed, boys.
4
u/ralusek Mar 31 '18
A better typo yet would have been
I always hear use Putin for training and Gulag for execution.
2
1
u/nickangtc Apr 03 '18
Excited as a JS dev, but still not sure what potential use cases there are for this. I'm obviously uninitiated to ML (though interested)... can someone throw some potential use cases out for me to grapple with this new development?
1
-1
u/SamSlate Mar 30 '18
now add gpu acceleration!
14
u/carlthome Mar 30 '18
That's already the main feature of this library (along with automatic gradient computation, of course).
0
u/SamSlate Mar 30 '18
wait really? i saw it's webgl i want sure if that meant it actually rendered on a card or not 😲
-2
u/rebelrogue995 Mar 30 '18
This is pretty cool, but can it make toast?
3
u/pslatt Mar 30 '18
It makes great toast.
3
-9
u/Hcmichael21 Mar 30 '18
Big if true
-1
u/-lambda- Mar 30 '18
if(true) big();
1
0
4
u/KnifelikeGuts Mar 31 '18
This looks like a fork of deeplearn.js with only a few additional examples https://deeplearnjs.org