If you invested $3,000 in graphics-chip specialist NVIDIA (NASDAQ:NVDA) five years ago, you'd now be sitting on top of $40,200 -- assuming you reinvested your modest dividends.

This is an incredible haul considering the broader market would have turned your $3,000 into about $5,800.

Let's look at what's happened with NVIDIA in recent years to cause investors to drive up the price of its stock, with an eye towards determining if the stock still looks like an attractive buy today.

Outline of a human head with digital elements inside it -- concept for artificial intelligence.

Image source: Getty Images.

Transformation from just a chipmaker into an AI player

NVIDIA stock's tremendous price rise in recent years has been well-earned, as the company has been posting massive growth in revenue and earnings. This growth has largely been driven by NVIDIA's successful transition from a company heavily focused on graphics processing units (GPUs) for gaming and professional visualization applications into a company that's also a player in the burgeoning artificial intelligence (AI) space.

It turns out that the company's GPUs are great at training artificial neural networks how to think like humans, a developing category of AI called deep learning. Once this became clear to NVIDIA's founder-CEO, Jensen Huang, he began aggressively focusing the company's efforts on optimizing its GPUs for AI applications -- a fact that demonstrates the company's nimbleness.

NVIDIA's traditional gaming market has been performing very well -- revenue jumped 52% year over year in the second quarter of fiscal 2018, accounting for just over 53% of total revenue -- and its professional visualization market has been performing solidly. However, it's the company's AI-driven data-center business that is its most powerful growth engine, with revenue in this market platform soaring 175% year over year last quarter. The data-center segment blew by professional visualization in revenue size over the last year and is now NVIDIA's second-largest business; it accounted for nearly 19% of total revenue last quarter.

NVIDIA's smallest target market platform, auto, is at the cusp of benefiting big from AI. In the spring of 2016, the company began shipping its DRIVE PX 2 AI platform, a supercomputer for processing and making sense out of the data taken in by all the sensors about the surroundings of semi-autonomous and fully autonomous vehicles. NVIDIA has notched several huge wins in this space. In October, electric-vehicle maker Tesla began using DRIVE PX 2 to power its autopilot on all new vehicles. In 2017, automakers Toyota, Audi, Mercedes-Benz, and Volvo announced plans to use DRIVE PX 2 to power their autonomous driving systems in vehicles planned for market introduction. And Chinese search engine giant Baidu announced this summer that it's adopting the platform for its driverless vehicles initiative and partnerships.

NVDA Total Return Price Chart

Data by YCharts.

A pretty picture of the past, but how does NVIDIA stock look now? 

NVIDIA stock is pricey based on Wall Street analysts' earnings estimates. It's trading at 42.9 times analysts' projected forward earnings, and it sports a five-year PEG (P/E to projected earnings growth five years out) of 3.6. (For some context, fellow chipmaker Intel has a five-year PEG of 1.4.) 

However, I don't place much stock (pardon the pun) in analysts' forward earnings estimates. As a group, they've been significantly underestimating NVIDIA's earnings for quite some time -- by percentages ranging from 19.3% to 45.6% in the last four quarters, for instance. So it seems much more likely than not that this dynamic will continue -- and if it does, then the stock will prove to be not as pricey as suggested by the forward valuations. 

Analysts expect NVIDIA's earnings to jump 40.6% year over year in the current year and then slow to an average annual growth rate of just 12.9% over the next five years. The odds are highly in favor of that 12.9% proving to be too conservative, in my opinion. This is a company that has a leading position in AI-driven data centers and driverless car applications, and it is poised to get a nice boost once virtual reality and augmented reality take off. That's not to mention NVIDIA's leading position in supplying graphics cards for gaming, which is booming thanks to esports and other factors, or the recent tailwind it's been getting from the rising prices and popularity of cryptocurrencies, such as Bitcoin. (GPUs, as it turns out, are great at mining cryptocurrencies.) 

NVIDIA stock could pull back over the short or intermediate term, as it's due for a breather. The market might do what it often does -- overreact -- when growth slows next year, as it almost surely will because the year-over-year comparables are going to be mighty tough. However, if NVIDIA's GPU-based approach to deep learning remains the favored approach (or even one of several favored approaches, as competition surely will heat up) to this subcategory of AI, then investors should be richly rewarded over the long term. AI promises to be gargantuan and touch just about all industries. 

NVIDIA is certainly not a stock to bet your house on, but it has a good risk-reward profile for those who have a longer-term investing outlook and are comfortable with a moderate amount of risk and volatility. 

Suzanne Frey, an executive at Alphabet, is a member of The Motley Fool's board of directors. Beth McKenna owns shares of NVIDIA. The Motley Fool owns shares of and recommends Alphabet (A shares), Alphabet (C shares), Amazon, Baidu, Facebook, Netflix, NVIDIA, and Tesla. The Motley Fool recommends Intel. The Motley Fool has a disclosure policy.