SAN FRANCISCO (Reuters) - Investors saddled in 2017 with the market’s worst performers, including Under Armour and General Electric, may do well to remember as December draws to an end that lumps of coal sometimes turn into diamonds.

FILE PHOTO: A street sign for Wall Street is seen outside the New York Stock Exchange (NYSE) in New York City, U.S., December 28, 2016. REUTERS/Andrew Kelly/File Photo

As investment advisors rebalance clients’ portfolios in the final weeks of the year, the instinct to dump stocks that have been left behind in surging markets - or that fall out of favor with analysts - can be self-destructive.

With the S&P 500’s rally pushing price/earnings multiples to highs not seen since 2002, laggards overlooked by a rush to own technology and other high-growth stocks may attract bargain-hunting investors heading into 2017.

“A contrarian strategy of buying beaten-up names might have a good year,” said Tim Ghriskey, chief investment officer of Solaris Group in Bedford Hills, New York.

Ghriskey in recent months bought shares of General Electric GE.N, which has slumped 45 percent this year as it struggles with a shift from coal and gas to renewable energy. He believes the 125-year-old conglomerate will claw its way back to growth, or might be split into multiple companies.

Some of the worst-performing stocks of 2016 roared back to life in 2017, including Vertex Pharmaceuticals VRTX.O and medical device maker Illumina ILMN.O. Those two companies this year have rebounded 69 percent or more.

As he rebalances clients' portfolios this month, Jake Dollarhide, head of Longbow Asset Management in Tulsa, Oklahoma, is investing more in Kroger Co KR.N and other supermarkets that took a beating after Amazon.com AMZN.O said in June it was buying Whole Food Markets.

Kroger has lost 20 percent year to date and it recently traded at 14 times expected earnings, compared to its five-year average of 27.

“Grocery is local; it’s not an internet play. And Kroger has the footprint to not even notice that Amazon is around,” Dollarhide said.

Investors following the Dogs of the Dow investment strategy each year buy components of the Dow Jones Industrial Average with the highest dividend yield, betting that those stocks have been oversold. Currently, those companies include Verizon Communications VZ.N, International Business Machines IBM.N and Exxon Mobil XOM.N, all with dividend yields of 3.7 percent or more.

Those three stocks were also Dogs of the Dow at the start of this year, and they have underperformed. But an investor following that strategy last December also would have bought Boeing BA.N, which has nearly doubled in 2017, Caterpillar CAT.N, which is up 64 percent, and Cisco Systems CSCO.O, which has risen 28 percent.

Nike NKE.N in 2016 suffered a 19-percent drop, making it the worst-performing Dow component. In the past 12 months, however, it has surged back with a 25 percent rally.

Due partly to increased competition from Nike, Under Armour UAA.N has slumped 48 percent year to date, making it the S&P 500's third-worst-performing stock. Last January, most analysts recommended buying Under Armour's shares and none recommended selling. Now, most analysts are neutral on the yoga-pant pioneer.

Underscoring the fallibility of analysts, four of the 10 S&P 500 worst-rated stocks at the end of last year are on track to finish 2017 with annual increases above the index’s 20-perent gain.

Among them, domain name registration provider VeriSign VRSN.O has surged 53 percent, while Emerson Electric EMR.N has rallied 24 percent, with much of that gain in the past month after the industrial-automation systems maker abandoned its bid for Rockwell Automation Inc ROK.N.

2017's diamonds and lumps of coal: tmsnrt.rs/2BhvwkC