In the present study, experiments are performed to determine the changes in the viscosity of water-Fe3O4 magnetic nanofluid (MNF) with shear rate, nanoparticle concentration and magnetic field (MF) induction. Itwas observed that as the shear rate elevates, the MNF viscosity first diminishes and then remains almost constant. Besides, the viscosity elevated with the application of theMF and its induction and also with increasing the concentration of nanoparticles. As another novelty of this research, a novel kernel based machine learning scheme namely, grid optimization based-kernel ridge regression (Grid-KRR) modelwas developed to accurate prediction of viscosity ofwater-Fe3O4MNF based on volume fraction of nanoparticles, shear rate, andmagnitude of external MF as input features. Besides, the Randomforest (RF) and Gene expression programming (GEP) modelswere examined for validating the Grid-KRR model. The performance criteria demonstrated that the Grid-KRR outperformed the RF.