AI 资讯
Linear Regression: From Least Squares to Production-Ready Practice
Linear Regression: From Least Squares to Production-Ready Practice Tags : machinelearning , datascience , python , tutorial Linear regression is the first algorithm most people learn, and the one most people never study deeply. It is also the model you will still find in production after fancier algorithms fail, because it is fast, stable, and explainable. This article is not a "call .fit() and read the score" tutorial. We will cover the math, the statistical assumptions, the diagnostics, regularization, evaluation, production concerns, and the interview questions that separate beginners from engineers. Why Linear Regression Deserves a Second Look Linear regression is the foundation for understanding almost every other supervised model: Logistic regression is linear regression with a sigmoid on top. Ridge and Lasso are linear regression with constrained weights. Neural networks are stacked linear transformations with nonlinear activations. Tree models are judged against the same baseline: "can I beat a linear model?" More importantly, linear regression is still the right answer in many business problems. When you need to explain a prediction to a regulator, a client, or a finance team, a clean linear model with interpretable coefficients beats a black box. The Math: Least Squares and the Normal Equation Given features X and target y , a linear model assumes: y = X * beta + epsilon The goal is to minimize the residual sum of squares: L(beta) = ||y - X*beta||^2 Taking the derivative with respect to beta and setting it to zero gives the normal equation : beta = (X^T * X)^(-1) * X^T * y In practice, use the pseudoinverse ( pinv ) instead of the inverse, because X^T X may be singular or numerically unstable when features are collinear. import numpy as np def normal_equation ( X , y ): Xb = np . c_ [ np . ones ( X . shape [ 0 ]), X ] # add intercept beta = np . linalg . pinv ( Xb . T @ Xb ) @ Xb . T @ y return beta Three Equivalent Views of Least Squares 1. Geometric view
科技前沿
SpaceX’s Falcon 9 Rocket Is About to Crash Into the Moon—and It Could Be Visible From Earth
The impact will kick up a plume of debris so high, it’ll likely be visible through some telescopes. Astronomers will be watching.
科技前沿
Not just Neanderthals: Ghost lineage in Africa left its mark on our DNA
Some group with no modern descendants contributed a lot to our genomes.
开发者
Researchers devise a full-color night vision goggle
Wavelength and intensity in the infrared are translated into colors in the visible.
科技前沿
China could supply EV manufacturing boom with recycled EVs
Look at chemistry of batteries and motors shows big opportunity for recycling.
AI 资讯
This tattoo is permanent, pain-free, and might soon come in the mail
The refurbished railway station in London I entered last week had none of the usual signs of being a tattoo studio. The walls were devoid of any art, and there were no reclining chairs or massage tables in the room. The only tattoo gun on the premises sat in a display case instead of buzzing […]
科技前沿
The World Is Too Hot. El Niño Is Partly to Blame
Heat waves are simultaneously hitting Europe, North America, and Asia, driven in part by the hot waters in the tropical Pacific—and climate change.
AI 资讯
Whizz: Your Esoteric Language that's Short as BF, but Easier to Write
I just made Whizz, an esoteric programming language that is full of capability and possible experimentation. Before I interest you in that, I'll explain to you something. What is an esoteric programming language? An esoteric language (or an esolang, colloquially), is a programming language designed to not fit the coding 'norms' or conventions. Take an example: BF ('BF' is an abbreviation and euphemism of brainf***). A standard language would notate a 'Hello, World!' program as something like: print ( " Hello, World! " ) BF, on the other hand, requires something like this: ++++++++ [ > ++++ [ > ++ > +++ > +++ > + <<<< - ] > + > + > - >> + [ < ] < - ] >> . > ---.+++++++..+++. >> . < -. < .+++.------.--------. >> +. > ++. As you can see, BF, like most esolangs, is different: it's hard to write and a puzzle. Whizz is inspired by BF, as its incrementing, decrementing and looping are inspired by it. I made Whizz because I thought languages like BF were way too monotonous to write. Esolangs should be hard and puzzling to write, but not laborious. BF requires you type '+' as many times you want to increment (without loops): so you have to find shortcuts and unscalable solutions, just to achieve your goal. In Whizz, just type that incrementation repetition count before the '+' sign, and there you have it! These wonderful features that Whizz boasts keep the challenge in esolang-ing, but contradictorily makes it more 'scalable'. Another notable feature is functions: the epitome of order. An example of a Whizz program would be: zeroToNine { [ create variables ] counter 10+ [ track state ] char 48+ [ print this one ] space 32+ [ space char ] ( char!+ [ print and increment char ] counter-; [ decrement counter and end if zero ] space! [ print space ] ) } zeroToNine* This, self explanatorily, outputs '0 1 2 3 4 5 6 7 8 9'. Again, in minimized form: c10+n48+s32+(n!+c-;s!) I genuinely hope you experiment with Whizz, and solve puzzles & challenges with it, as if it were BF! Install it
产品设计
Space Force-backed mission does its best impression of Top Gun in orbit
"Dogfighting in space doesn’t quite have the drama of an aerial dogfight."
AI 资讯
NASA’s Curiosity rover found a ‘sea of polygons’ on Mars
The latest discovery from NASA's Curiosity Mars rover is a field of honeycomb-shaped polygons covering a Martian valley called Valle Grande. As Gizmodo reports, Curiosity has snapped pictures of the unusual terrain texture before, called polygonal fractures, each about 1.5 to 3 inches wide, but NASA says it's previously only found them in small patches, […]
开发者
Quantum computers outperform classical ones, with results you can trust
Three approaches to the issue of quantum results that can't be verified classically.
AI 资讯
From Learning Machine Learning to Competing on Kaggle: My First End-to-End Playground Competition Journey
How I applied Exploratory Data Analysis, Feature Engineering, Pipelines, and Ensemble Models to solve a real-world machine learning problem—and the lessons I learned along the way. Introduction There comes a point in every machine learning learner's journey when watching tutorials and completing small practice exercises are no longer enough. After spending weeks understanding statistics, exploratory data analysis (EDA), feature engineering, preprocessing techniques, and classical machine learning algorithms, I wanted to answer one question: Can I apply everything I've learned to a real machine learning competition? That's when I decided to participate in a Kaggle Playground competition. Unlike classroom datasets, Kaggle competitions force you to think like a machine learning engineer. You're responsible for understanding messy data, building preprocessing pipelines, selecting models, evaluating performance, debugging errors, and finally creating a submission that competes with thousands of participants. This article documents my complete journey—from loading the dataset to building production-style preprocessing pipelines and training multiple ensemble models. Along the way, I'll also share the challenges I faced, what worked well, and the lessons I'll carry into future competitions. Why Kaggle? Learning machine learning isn't just about knowing algorithms. Real-world ML requires answering questions like: Which features are useful? How should missing values be handled? Should categorical variables be one-hot encoded or ordinal encoded? Which preprocessing steps belong inside a pipeline? How do different ensemble models compare? Kaggle provides an environment where all of these questions matter. Instead of building a model that works only inside a notebook, you're solving a problem under realistic constraints and evaluating your solution on unseen data. Competition Goal The objective of this Playground competition was to predict the target class based on a combinatio
产品设计
Yet more qubit tech: New quantum dot options, diamond vacancies
Companies are making sure we have a surplus of options for building qubits.
科技前沿
Tropical Diseases Like Dengue Fever and Chikungunya Are on the Rise in Europe
Climate change is helping invasive species to not only establish themselves across the continent but to stay alive for longer. Scientists suggest we get used to it.
AI 资讯
What happens when you put AI to work deciphering lost languages?
AI is fantastic at spotting patterns, but human insight is the key.
AI 资讯
DoorDash is going airborne with new drone delivery division
DoorDash is launching a new drone delivery program called DoorDash Air. The largest food delivery app in the US said that it has approval from the Federal Aviation Administration that clears the way for drone delivery in the near future. DoorDash said it has received a Part 135 air carrier certification from the FAA that […]
产品设计
How to Bring a Geothermal Well Back from the Dead
Startup Zanskar has created one of the most productive geothermal wells in the US at a power plant that had been in decline for years.
AI 资讯
NASA’s New 3D Model Shows the Earth Is a Lumpy Mess
We like to think of our home as a nice, smooth sphere. But mapping the Earth’s gravitational field provides a different view of the planet.
AI 资讯
How do you measure something that gives a different answer every time?
I had a simple-sounding question: does ChatGPT recommend this business? You'd think you just ask it. Ask ChatGPT "best personal injury law firm in NYC", see if the business is named, record yes or no. That works exactly once. Ask again an hour later and you might get a different answer. Not slightly different — potentially a completely different set of firms and a completely different set of cited sources. Which means the naive version of this measurement is worthless. You're not measuring visibility, you're sampling a distribution once and calling it a fact. This is the same problem anyone gets when they try to test an LLM-backed feature. Your normal testing instinct — same input, assert on output — just doesn't apply. So here's how I ended up designing around it, and the numbers that came out, which surprised me. The setup I wanted to compare four assistants (GPT-4o, Claude Haiku 4.5, Gemini 2.5 Flash, Perplexity Sonar, all with web search on) across 10 buyer-intent questions in one vertical. Something like: "Best personal injury law firm in New York City?" "Top immigration lawyers in Mumbai?" For each response I recorded two things: which businesses got named, and which URLs got cited. The cited sources come from each API's own citation metadata, so that part is structured — no scraping the prose. First pass, the results looked dramatic. The four assistants barely agreed on anything. Different firms, different sources, almost no overlap. Great finding. Except I couldn't publish it, because there was an obvious objection I couldn't answer: Maybe they weren't disagreeing with each other. Maybe each one was just disagreeing with itself. If a single assistant returns wildly different sources run to run, then "these four models cite different things" is a meaningless statement. You'd be measuring noise and calling it signal. The control The fix is the same idea as a control group. Measure the thing you're worried about, separately, and see if it explains your result.
AI 资讯
The 8 Most Expensive Unit Conversion Mistakes in Engineering History — and the Software Bugs That Caused Them
TL;DR Eight engineering disasters. Zero arithmetic errors. Every single one was caused by two numbers — both correct, both carefully computed — meaning different things on opposite sides of a software interface. One cost $65 billion. Another killed 28 soldiers because 0.1 can't be represented in binary. The fix is never the math. The fix is the label. There is a particular kind of silence in a control room when someone realizes the number on the screen is in the wrong unit. It lasts about two seconds. Then it's replaced by the kind of noise nobody wants to hear. On September 23, 1999, that silence happened at the Jet Propulsion Laboratory in Pasadena, California. The Mars Climate Orbiter had just disappeared behind the planet. Telemetry showed the spacecraft at 57 kilometers above the surface. It was supposed to be at 140. The silence was four seconds long. Then someone said "oh no" — the official NASA transcript uses a stronger word — and $327 million of aluminum, titanium, and human effort disintegrated into the Martian atmosphere. What follows are eight stories about the same bug, wearing different uniforms. Some are famous. Some you've never heard of. Two of them are pure software failures that every developer who's ever written for (let i = 0; i < 10; i += 0.1) has come within a rounding error of replicating. 1. The Patriot Missile — When 0.1 Is Not 0.1 (1991) Let's start with the one that belongs in every CS curriculum. Because this isn't a "unit conversion" error in the traditional sense — nobody confused meters and feet. The error was in the way a computer counted time. And it killed 28 American soldiers in a warehouse in Dhahran, Saudi Arabia. The MIM-104 Patriot missile system tracks incoming targets using a phased-array radar. The radar scans the sky, and the fire-control computer predicts where the target will be when the interceptor arrives. That prediction depends on knowing exactly when the radar echo returned. Time is measured by the system's interna