Hollywood History: Oh so very much. It's not quite as bad as the Medieval Japan trope, but it mangles quite a bit of the history of 1860s and 1870s Japan. The biggest problem is that it conflates the Boshin War of 1868 with the later Satsuma Rebellion of 1877. In the Boshin War, the Imperialist faction made up of samurai from Satsuma (Kagoshima), Choshu (Yamaguchi) and Tosa (Kochi) defeated the Shogun's nascent Western-style army, largely because they were much more experienced with Western-style tactics and weaponry than the Shogun's side, which had only just adopted them. The turning point was the Battle of Toba-Fushimi in Kyoto, after which the Shogun put himself "at the disposal of the Emperor", ending the Shogunate politically (though not yet militarily).
In the Satsuma Rebellion, the same samurai who had led the Imperial restoration were incensed over the elimination of their social status, exclusive right to bear arms, and rice stipend by the Meiji government, and led a revolt under the banner of Saigo Takamori (the historical "Last True Samurai"). They were defeated at the Battle of Shiroyama in Kagoshima, where, outnumbered and outgunned, Saigo committed ritual suicide and his remaining followers died in a suicide charge on the army's front lines. At this point, both sides were entirely equipped with Western tactics, weaponry, and uniforms (in fact, nearly all depictions of Saigo show him wearing a French uniform, and never the traditional samurai armor, which at any rate was a relic of the Warring States period some 300 years earlier). Moreover, the Imperial Army of the time was composed mainly of members of the Tokyo police force, which itself was largely made up of former samurai from the provinces.
Algren's character was inspired by Jules Brunet, a French army officer who was sent to Japan in 1867 to train the army of the Shogunate for the coming battle with the Imperialist Satsuma-Choshu alliance. The troops lost anyway, but rather than get captured and defect to the other side, Brunet fled north with the remnants of the Shogun's army to Hokkaido, where he bore witness to the short-lived Republic of Ezo and the Shogunate's final defeat at the Battle of Hakodate. He never came around to the Imperial side, but his legacy was later rehabilitated by the Japanese government in recognition of his love for Japan and promotion of the country abroad.
Meanwhile, the samurai ethos, as portrayed in the film, is more a product of what came after them. Traditional battle tactics and weaponry had all been eliminated as ineffective against their Western counterparts, but the image of the Satsuma samurai — going into battle for their very survival, knowing the odds were hopeless, but choosing to die with their era — was romanticized and appropriated by the Meiji government. The traits we consider part and parcel of the samurai now — their stoic nature, the honor of bushido, and their selfless sacrifice for the lord they served (or, as reinterpreted by Imperial Japan, the Emperor) — were cynically used as propaganda, both inside and outside the military, as the ideal of Japanese character. (This was probably helped by the fact the samurai were no longer around to cut down commoners at the slightest provocation.) Contrary to what the film suggests, this was not sucha good thing in the longrun.
To clarify — the Meiji restoration (really a "revolution" both culturally and politically)note In Japanese, the word used is isshin, or "renovation", as the Meiji Emperor was never NOT Emperor, just that until 1872, the Imperial house was shunted off to the side as a figurehead, with all practical power exercised by the Shogunate, with the isshin reversing that turn of events and renovating the status of the Emperor upended the existing order, fundamentally changing the relationship between Religion and the Nation, the Military and the State and Japan's place in the world. While the Meiji government successfully consolidated its power through military conscription, compulsory education/propaganda, and co-opting Shinto as a state religion centered on the Emperor, its wholesale tinkering with the very fabric of the nation had unforeseen consequences. Twosuccessful wars against established empires and one world economic crisis later, Japan had a state religion centered on the figurehead of a military-dominated government, and a people trained from birth to believe it was Japan's divinely-ordained mission to either civilize or subjugate the rest of Asia in the name of countering Western colonialism, by whatever means necessary. And that set-up was more than just asking for trouble — it was actively fomenting it and expecting things to work out okay somehow, regardless. Oops, indeed.