Rarely a secret, yes. But it's not like there's a public database of composer:song mappings anywhere†, for you to easily feed your ML algorithm; you'd have to do a bunch of original research to build that dataset. If there's some statistical way to infer the data with nearly the same quality, so that you don't need to go to the effort of building the dataset yourself, that'd be nice.
† An assumption on my part—is there, in fact, a place where you can look up who gets each portion of the royalties for a given song?
I like to fact-check my assertions prior to making them, unless I'm being metaphysical. Not snark; it's just a huge time saver.
There are a bunch of such datasets, some commercial but accessible for a small fee (like ASCAP), others freely available. I personally like the Discogs one best but some of the commercial offerings are better curated.
Wikipedia does a great job of listing credited song writers, from what I've seen. Just check out the detail in a Beyonce or Maroon 5 album. It's like a public CV.
Edit: I just looked up a Maroon 5 album, "Overexposed" and found a few credits to M. Martin. So I clicked on "Daylight." M. Martin. Max Martin.
† An assumption on my part—is there, in fact, a place where you can look up who gets each portion of the royalties for a given song?