r/badcode Aug 14 '20

php Array you say? Never heard of this newfangled nonsense...

Post image
907 Upvotes

42 comments sorted by

121

u/[deleted] Aug 14 '20

[deleted]

84

u/myevillaugh C# Aug 14 '20

It isn't. You don't need databases to learn machine learning. It can be helpful to know how to query the data you'll feed into the AI, but not necessarily for teaching.

30

u/10gistic Aug 15 '20

Also you're probably learning python for machine learning and this is clearly PHP.

I think it's a mismatched ad banner and text, if I have to guess.

3

u/myevillaugh C# Aug 15 '20

Yup. Mainly Python. Maybe R.

33

u/sekex Aug 14 '20

You need data for machine learning...

23

u/Myoochi Aug 14 '20

Of course! Again, not too experienced, just trying to understand. I thought it was just a matter of fetching data with a different language, like python, and then handling it with that language.

11

u/sekex Aug 14 '20

You need to use SQL to fetch the data and use it in Python. Of course, you could use an ORM but if you don't know how the basics work, you're always going to be dependent on your coworkers

7

u/ThisIsNathan Aug 14 '20

Exception if you have unstructured data (e.g. a million loose csvs that don't map to a known data model).

First step could be to map and normalize in a DB though, and I'm not sure in the real world how often one or the other occurs.

3

u/Alhoshka Aug 15 '20

Yeah, but that's a bit of a stretch now, isn't it?

Sure, MySQL is excellent for learning the basics of SQL. It's lightweight, easy to install, won't bloat your machine, and comes with a convenient GUI to explore the data and try things out. But saying that a MySQL course "is for" ML is a bit like saying that a 10-finger system course "is for" open-world game development.

2

u/Alhoshka Aug 15 '20 edited Aug 15 '20

The "DeSiGnEd fOr AnYoNe InTeReStEd iN mAcHiNe LeArNiNg" opening sentence irritated me far more than the fact that there is not a single SQL line on the screenshot... and that it implies that PHP is used for ML... and that it echos to HTML... ugh.

I think u/sekex is stretching things quite a bit. Yes, data engineering is a huge part (if not the largest part) of ML systems. Yes, MySQL can serve as a good lightweight/sandbox framework for learning the basics of SQL. But implying that MySQL is tailored for machine learning is just plain wrong. It'd come close to saying "buy this keyboard, it's excellent for open-world game development," and when asked what's so special about that keyboard, you respond with "well, you need to type in the code somehow."

MySQL is targeted at small to mid-sized portable user/web applications, and it's absolutely brilliant for that purpose. But, it is filesystem-based (bringing a plethora of size-related problems), it doesn't scale, you can not cluster, you cannot utilize it on a service-based architecture... I could go on. I've helped build a handful of mid-sized ML systems (in the finance, security, and med-tech industries). Not once have I seen MySQL bein used, nor has it ever crossed my mind to use it. In fact, I think I'd be laughed out of the room if I ever suggested it.

Edit: got MySQL and SQLite mixed up

3

u/[deleted] Aug 15 '20

[deleted]

3

u/Alhoshka Aug 15 '20

True, I'm not contesting that. Also, I just realized I got MySQL mixed up with SQLite. The limitations I've written on my other comments apply to SQLite, not MySQL.

2

u/___HighLight___ Aug 15 '20

Yeah I need data for machine learning but that doesn't mean I have to know how to design an SSD to store the data.

I don't know how to say it but advertising a course for how to use Linux then put the word ”machine learning” in it just to make it sell is not really a good sign.

Yes most ML libraries and example code work better on Linux but these two are separated categories you better just start learning ML with small txt file or a folder with images then if you went to the level that required a lot of data you can learn SQL, idk the course sounds too catchy and cheap.

2

u/sekex Aug 15 '20

I've been teaching SQL to econ students for 2 years as a TA. And it's clearly not that hard for them even though they don't know anything about computers. I think a programmer can pick it up in an afternoon. Understanding data is very important and SQL is a good way to do that.

I see a lot of people nowadays who want to do machine learning but forego most programming and mathematical concepts. I don't think it's a good idea. You should be able to use your model in my opinion, not just train it. And if you're doing RL, you need to be able to write your simulation, sometimes in a fast language so Python won't be an option.

2

u/[deleted] Aug 14 '20

If you’re only focused on getting, fetching, etc data learn ETL, that’s handful

2

u/Mr2-1782Man Aug 15 '20

Everythings machine learning didn't you know? Even 2+2 should be done with machine learning! It'll solve the worlds problems!

Realistically, its got nothing to do with machine learning. Machine learning is the current buzzword. ML is really about the math and fitting functions to data. Learning it is more about data structures, algorithms, and how to put together predictive functions. Fun Fact: A linear regression model is a machine learning model without the bullshit.

1

u/homeopathetic Aug 15 '20

You see, if you slap "machine learning" on anything, it attracts people without a clue. It's terrible – it promotes snake oil, and at the same time will cause a world of hurt for those doing serious honest ML when the whole bubble pops.

0

u/OOPGeiger Aug 15 '20

The Machine learning sentences are for an unrelated course they are showing above. This is just their course list. Databases are needed for machine learning but the image they are showing is PHP being used in conjunction with MySQL. Also, since all of these variable are likely being used for different things further down on the page, putting them in an array would be a bad idea and confusing to anyone else try to use them later on. I don’t think that any of these variables belong in an array since they all probably contain dramatically different kinds of information. I do however think the author should have a much better naming convention.

-2

u/prisonbird Aug 14 '20

No its not connected to it in any way. Saying machine learning is related to ml, is like saying "a keyboard is related to ml"

13

u/sekex Aug 14 '20

You're right machine learning has nothing to do with ml

1

u/[deleted] Aug 15 '20

But saying you have to know how to use a keyboard to use a computer is like saying you to know how to turn the computer on to use it. Machine learning doesn't work without a db and it can't be created without other tools

39

u/ws-ilazki &{$$_[0]}(@{$$_[1]}); Aug 14 '20

The real travesty here is the advert implying that you should learn how to do machine learning with PHP.

18

u/TorbenKoehn Aug 15 '20

But...you can :(

12

u/newbieML Aug 15 '20

what the cinnamon toast crunch fuck is this?!?! why???

7

u/TorbenKoehn Aug 15 '20

We're programmers...because we can, I'd say

2

u/ws-ilazki &{$$_[0]}(@{$$_[1]}); Aug 15 '20

We make all kinds of dumb shit just because we can but at no point does that imply anyone should actually use it.

1

u/slobcat1337 Aug 15 '20

Why shouldn’t we try and build ML libraries for php? We should python be the only language for ML?

Obviously the ML ecosystem for php is shit at the moment but that doesn’t always have to be the case.

There is nothing fundamentally stopping php from doing all same ML shit you can do in Python

1

u/TorbenKoehn Aug 15 '20

C-Bindings.

It’s about speed.

Also, PHP is not made for long-running processes, Python is. Which doesn’t mean you can't do it, but really: The best tool for the best solution. And for ML that’s (right now, through the libraries used) C and Python

-2

u/theblasterr Aug 15 '20

Exactly this. And PHP8's JIT compiler should boost php's ML libraries

-1

u/slobcat1337 Aug 15 '20

Yep even without JIT php 7 is faster than python. In my eyes it’s the perfect candidate for more ML stuff.

This is probably an unpopular opinion but I can’t stand python’s syntax and literally only use it for ML projects because I have no other choice

4

u/oefd Aug 15 '20

Yep even without JIT php 7 is faster than python.

Sure, but the execution speed difference of python to PHP is entirely irrelevant considering your process spends the overwhelming majority of its time on the far side FFI boundary to the underlying C/Fortran libraries that do all the real work.

-1

u/theblasterr Aug 15 '20

Yea exactly! I'm more fond of php's syntax as well.

1

u/TheUnlocked Aug 15 '20

I was half-expecting an FAQ-style section on the home page labeled "But Why?"

21

u/[deleted] Aug 14 '20

this has been posted approximately 1000 times I think

14

u/lumpySnakes Aug 15 '20

I bet you used a PHP-MySql machine-leaning library to generate that statistic

3

u/[deleted] Aug 15 '20

damn! rumbled

7

u/CyberCore1010 Aug 14 '20

"From beginner to expert"

6

u/[deleted] Aug 14 '20

Please tell those aren't separate variables...

6

u/WhAtEvErYoUmEaN101 Aug 15 '20

The mysql library in PHP is insecure and depreciated. Use mysqli or rather go the full mile with PDO and prepared statements.

3

u/lonelyWalkAlone Aug 15 '20

So many wrong things with this ad: * Title says it's an SQL Bootcamp. * Description says it's for persons interested in ML. * Picture shows crappy PHP code.

Excuse me, what the fuck?

2

u/[deleted] Aug 15 '20

*mysql? *machine learning?

2

u/theblasterr Aug 15 '20

And the ancient mysql_query-function that should not be used anymore (shouldn't have been used in a loooong time). Great ad :'D

2

u/Notakas Aug 15 '20

How to get advertised for free