4 ms·
If the choices are "it worked in 2017" and "it was written by AI" then clearly it was AI: 1) The program is invalid. The "predictionsaccuracy" should be "accur
by eesmith 3y ago
If the choices are "it worked in 2017" and "it was written by AI" then clearly it was AI:
1) The program is invalid. The "predictionsaccuracy" should be "accuracy".
Therefore it cannot be working code from 2017. Furthermore,
2) The loadtxt() does not read the linked-to CSV file because of the header line. NumPy reports: 'ValueError: could not convert string 'Pregnancies' to float64 at row 0, column 1.'
The fix is to add skiprows=1 to the loadtxt().
As a couple of style notes:
3) Modern Python prefers f-strings, f"Accuracy: {accuracy*100.0:.2f}")
4) The y_pred contains only 0s or 1s so the following is unneeded
predictions = [round(value) for value in y_pred]
and y_pred can be passed directly to accuracy_score().
- AndrewKemendo 3y agoWhat? It was written by a human in 2017 and worked then The code is from: https://machinelearningmastery.com/xgboost-with-python/ https://machinelearningmastery.com/xgboost-with-python/ Point being, this was firmly "AI" in 2017. It is still widely useful today. Is it no longer AI? If so why? Do people believe in the code above less now? If so, why? If not, then the title is wrong if it's AI.
- eesmith 3y agoThe code you posted does not work. Try it out. One of these two lines is incorrect: predictionsaccuracy = accuracy_score(y_test, predictions) print("Accuracy: %.2f%%" % (accuracy * 100.0)) Either the first line should be: accuracy = accuracy_score(y_test, predictions) or the second line should be: print("Accuracy: %.2f%%" % (predictionsaccuracy * 100.0)) I tried the corrected code against the CSV data file you pointed to, and got: ValueError: could not convert string 'Pregnancies' to float64 at row 0, column 1. You linked to a course that costs US$37. I don't see the code, though one of the images shows it uses that data set. Still, 1) tells me there's a copy&paste error, and 2) tells me that the dataset was somehow massaged. > Is it no longer AI? If so why? Okay, so I misunderstood your point. I thought your 'I promise you that anyone voting in this poll couldn't differentiate between what does and does not use "AI."' was in regards to the modern wave of using AI (typically LLM models) as a code assistant. Could someone tell if the code you posted was generated by an AI? I could tell that the code you posted was not working code, so if the choices were "working code written by human" and "output from an AI model", it clearly belongs to the latter. That is not your point, and I was wrong. However, the point of the article is not "what is AI?" but more like "how much should you trust the results of everything described as AI"? XGBoost was not generating false court citations. XGBoost was not generating images where the only scientists were white men. XGBoost was not submitting Stackoverflow answers. XGBoost was not classifying black men as gorillas. XGBoost is not the sort of AI that most people are thinking of when you say "AI". FWIW, I'm of the classical school, and I consider alpha–beta pruning to be part of AI.