# Getting Explicit Function Definition from Interpolate and Visualizing Data

I am doing 3D interpolation and I would like to get the function definition as output so that I can use it in gradient descent method optimization. My data set is of the form

x      y     z     loss
val1  val2  val3   val4


I would like to get a function definition from my interpolation of the form f(x,y,z)= loss. I need it in an explicit form like this so that I can do optimization using the function. I'm not well-versed in Mathematica so any assistance is very greatly appreciated.

Here is the code for the interpolation that I have tried:

func = Interpolation[data, InterpolationOrder -> 1]


After this runs I get an output saying Domain:{{4,8},{0.5,7},{0.7,2}} Output:Scalar

I could not get interpolation to work for "All". I got no error message, but whenever I would type something like func[4, .5, .72] I would not get a value back, just the same expression. I have no clue why this happened.

I then tried to get an explicit definition for the function that produces the values from the interpolation like this intfunc = Interpolation@data; but it did not work. Any suggestions on how to get the function out? Ideally I need a smooth function that I can use for gradient descent optimization.

Also, I tried to visualize the data in a few ways but nothing is working. So far I have tried Graphics3D[ Point[data, VertexColors -> (Hue /@ Rescale[func[##] & @@@ data])], Axes -> True, AxesLabel -> {x, y, z}] This took a very long time and produced nothing

I also tried: Manipulate[ Plot3D[​interpfun[x, y, z], {x, 0, 8}, {y, 0, 6}], {z, 0, 2}]  This gave an empty plot with a slider and did not plot any values.

Any suggestions on how I can visualize my data? I haven't used Mathematica in about 8 years. Any thoughts are very appreciated.

Here is some of my data:

data = {{{4.0, 2.5, 0.7}, 0.750341814}, {{4.0, 2.75, 0.7},
0.641510140}, {{4.0, 3.0, 0.7}, 0.622998451}, {{4.5, 2.3, 0.7},
0.730188891}, {{4.5, 2.6, 0.7}, 0.236956251}, {{4.5, 3.2, 0.7},
0.092038571}, {{4.5, 3.5, 0.7}, 0.088483203}, {{5.0, 2.25, 0.7},
0.948879277}, {{5.0, 2.6, 0.7}, 0.190624075}, {{5.0, 2.95, 0.7},
0.135275036}, {{5.0, 3.3, 0.7}, 0.032763743}, {{5.0, 3.65, 0.7},
0.029430211}, {{5.0, 4.0, 0.7}, 0.027537075}, {{5.5, 2.5, 0.7},
0.281232137}, {{5.5, 2.9, 0.7}, 0.054980707}, {{5.5, 3.3, 0.7},
0.023085488}, {{5.5, 3.7, 0.7}, 0.031317836}, {{5.5, 4.1, 0.7},
0.010820878}, {{5.5, 4.5, 0.7}, 0.010161860}, {{6.0, 2.3, 0.7},
0.397089577}, {{6.0, 2.75, 0.7}, 0.074292346}, {{6.0, 3.2, 0.7},
0.015918433}, {{6.0, 3.65, 0.7}, 0.004494633}, {{6.0, 4.1, 0.7},
0.002195262}, {{6.0, 4.55, 0.7}, 0.001750180}, {{6.0, 5.0, 0.7},
0.001701018}, {{6.5, 2.5, 0.7}, 0.322173220}, {{6.5, 3.0, 0.7},
0.037894300}, {{6.5, 3.5, 0.7}, 0.005178418}, {{6.5, 4.0, 0.7},
0.001170227}, {{6.5, 4.5, 0.7}, 0.001044620}, {{6.5, 5.0, 0.7},
0.000228311}, {{6.5, 5.5, 0.7}, 0.000204873}, {{7.0, 2.15, 0.7},
0.799562745}, {{7.0, 2.7, 0.7}, 0.169379167}, {{7.0, 3.25, 0.7},
0.019800399}, {{7.0, 3.8, 0.7}, 0.001902681}, {{7.0, 4.35, 0.7},
0.000501842}, {{7.0, 4.9, 0.7}, 0.000126206}, {{7.0, 5.45, 0.7},
0.000026700}, {{7.0, 6.0, 0.7}, 0.000020600}, {{7.5, 2.3, 0.7},
1.215594070}, {{7.5, 2.9, 0.7}, 0.050740772}, {{7.5, 3.5, 0.7},
0.009225684}, {{7.5, 4.1, 0.7}, 0.000752695}, {{7.5, 4.7, 0.7},
0.000144944}, {{7.5, 5.3, 0.7}, 0.000016200}, {{7.5, 5.9, 0.7},
0.000003720}, {{7.5, 6.5, 0.7}, 0.000002670}, {{8.0, 2.45, 0.7},
0.316357500}, {{8.0, 3.1, 0.7}, 0.049589355}, {{8.0, 3.75, 0.7},
0.001624453}, {{8.0, 4.4, 0.7}, 0.000321852}, {{8.0, 5.05, 0.7},
0.000043800}, {{8.0, 5.7, 0.7}, 0.000003320}, {{8.0, 6.35, 0.7},
0.000001040}, {{8.0, 7.0, 0.7}, 0.000000425}, {{4.0, 2.0, 0.83},
1.123030977}, {{4.0, 2.25, 0.83}, 0.643862594}, {{4.0, 2.5, 0.83},
0.494527641}, {{4.0, 2.75, 0.83},
0.460772203}, {{4.0, 3.0, 0.83}, 0.449952666}, {{4.5, 2.0, 0.83},
1.177597462}, {{4.5, 2.3, 0.83}, 0.246286304}, {{4.5, 2.6, 0.83},
0.126303219}, {{4.5, 2.9, 0.83}, 0.805843164}, {{4.5, 3.2, 0.83},
0.064124542}, {{4.5, 3.5, 0.83}, 0.063221002}, {{5.0, 1.9, 0.83},
0.959095797}, {{5.0, 2.25, 0.83}, 0.395763200}, {{5.0, 2.6, 0.83},
0.068053440}, {{5.0, 2.95, 0.83},
0.058924421}, {{5.0, 3.3, 0.83}, 0.018638068}, {{5.0, 3.65, 0.83},
0.016715326}, {{5.0, 4.0, 0.83}, 0.016485697}, {{5.5, 2.1, 0.83},
0.801945073}, {{5.5, 2.5, 0.83}, 0.121609842}, {{5.5, 2.9, 0.83},
0.022526237}, {{5.5, 3.3, 0.83}, 0.010862152}, {{5.5, 3.7, 0.83},
0.010286207}, {{5.5, 4.1, 0.83}, 0.007491423}, {{5.5, 4.5, 0.83},
0.007211895}, {{6.0, 2.3, 0.83},
0.160576165}, {{6.0, 2.75, 0.83}, 0.029644050}, {{6.0, 3.2, 0.83},
0.007040139}, {{6.0, 3.65, 0.83},
0.003064983}, {{6.0, 4.1, 0.83}, 0.002347885}, {{6.0, 4.55, 0.83},
0.002231154}, {{6.0, 5.0, 0.83}, 0.002229741}, {{6.5, 2.0, 0.83},
0.743003719}, {{6.5, 2.5, 0.83}, 0.091745464}, {{6.5, 3.0, 0.83},
0.011634382}, {{6.5, 3.5, 0.83}, 0.001858806}, {{6.5, 4.0, 0.83},
0.000625568}, {{6.5, 4.5, 0.83}, 0.000476692}, {{6.5, 5.0, 0.83},
0.000270385}, {{6.5, 5.5, 0.83},
0.000263443}, {{7.0, 2.15, 0.83}, 0.289692249}, {{7.0, 2.7, 0.83},
0.070986865}, {{7.0, 3.25, 0.83},
0.005445419}, {{7.0, 3.8, 0.83}, 0.000569259}, {{7.0, 4.35, 0.83},
0.000184639}, {{7.0, 4.9, 0.83},
0.000050600}, {{7.0, 5.45, 0.83}, 0.000019100}, {{7.0, 6.0, 0.83},
0.000017700}, {{7.5, 2.3, 0.83}, 0.427847385}, {{7.5, 2.9, 0.83},
0.016100380}, {{7.5, 3.5, 0.83}, 0.003665870}, {{7.5, 4.1, 0.83},
0.000201233}, {{7.5, 4.7, 0.83}, 0.000060600}, {{7.5, 5.3, 0.83},
0.000005190}, {{7.5, 5.9, 0.83}, 0.000002460}, {{7.5, 6.5, 0.83},
0.000002090}, {{8.0, 2.45, 0.83},
0.096275542}, {{8.0, 3.1, 0.83}, 0.017935820}, {{8.0, 3.75, 0.83},
0.000604182}, {{8.0, 4.4, 0.83},
0.000079200}, {{8.0, 5.05, 0.83}, 0.000017500}, {{8.0, 5.7, 0.83},
0.000000999}, {{8.0, 6.35, 0.83},
0.000000476}, {{8.0, 7.0, 0.83}, 0.000000303}, {{4.0, 2.25, 0.96},
1.177242345}, {{4.0, 2.5, 0.96},
0.903436502}, {{4.0, 2.75, 0.96}, 0.332421564}, {{4.0, 3.0, 0.96},
0.328294859}, {{4.5, 2.0, 0.96}, 0.610951015}, {{4.5, 2.3, 0.96},
0.673977792}, {{4.5, 2.6, 0.96}, 0.108851985}, {{4.5, 2.9, 0.96},
0.125798036}, {{4.5, 3.2, 0.96}, 0.164368921}, {{4.5, 3.5, 0.96},
0.083522130}, {{5.0, 2.25, 0.96},
0.173705123}, {{5.0, 2.6, 0.96}, 0.414522040}, {{5.0, 2.95, 0.96},
0.197962721}, {{5.0, 3.3, 0.96},
0.025581569}, {{5.0, 3.65, 0.96}, 0.026675785}, {{5.0, 4.0, 0.96},
0.025212890}, {{5.5, 2.1, 0.96}, 0.441425969}, {{5.5, 2.5, 0.96},
0.044996441}, {{5.5, 2.9, 0.96}, 0.306236219}, {{5.5, 3.3, 0.96},
0.010891276}, {{5.5, 3.7, 0.96}, 0.006561283}, {{5.5, 4.1, 0.96},
0.000851567}, {{5.5, 4.5, 0.96},
0.000718190}, {{6.0, 1.85, 0.96}, 0.807149508}, {{6.0, 2.3, 0.96},
0.065261072}, {{6.0, 2.75, 0.96},
0.062784999}, {{6.0, 3.2, 0.96}, 0.073790906}, {{6.0, 3.65, 0.96},
0.013393139}, {{6.0, 4.1, 0.96},
0.002261782}, {{6.0, 4.55, 0.96}, 0.001243003}, {{6.0, 5.0, 0.96},
0.001121045}, {{6.5, 2.0, 0.96}, 1.145752994}, {{6.5, 2.5, 0.96},
0.190715368}, {{6.5, 3.0, 0.96}, 0.039221201}, {{6.5, 3.5, 0.96},
0.023321520}, {{6.5, 4.0, 0.96}, 0.000322579}, {{6.5, 4.5, 0.96},
0.000220124}, {{6.5, 5.0, 0.96}, 0.000187539}, {{6.5, 5.5, 0.96},
0.000196152}, {{7.0, 2.15, 0.96},
0.554272538}, {{7.0, 2.7, 0.96}, 0.028907939}, {{7.0, 3.25, 0.96},
0.009721355}, {{7.0, 3.8, 0.96},
0.002695021}, {{7.0, 4.35, 0.96}, 0.000084600}, {{7.0, 4.9, 0.96},
0.000142253}, {{7.0, 5.45, 0.96},
0.000037600}, {{7.0, 6.0, 0.96}, 0.000034100}, {{7.5, 2.3, 0.96},
0.790029329}, {{7.5, 2.9, 0.96}, 0.072060300}, {{7.5, 3.5, 0.96},
0.001543552}, {{7.5, 4.1, 0.96}, 0.000462893}, {{7.5, 4.7, 0.96},
0.000071200}, {{7.5, 5.3, 0.96}, 0.000007440}, {{7.5, 5.9, 0.96},
0.000002120}, {{7.5, 6.5, 0.96}, 0.000002050}, {{8.0, 2.45, 0.96},
0.282324098}, {{8.0, 3.1, 0.96},
0.031273184}, {{8.0, 3.75, 0.96}, 0.000254968}, {{8.0, 4.4, 0.96},
0.000129261}, {{8.0, 5.05, 0.96},
0.000019400}, {{8.0, 5.7, 0.96}, 0.000002140}, {{8.0, 6.35, 0.96},
0.000000583}, {{8.0, 7.0, 0.96},
0.000000352}, {{4.0, 1.25, 1.09},
1.033148314}, {{4.0, 1.75, 1.09}, 0.740160273}, {{4.0, 2.0, 1.09},
0.529269079}, {{4.0, 2.25, 1.09},
0.461266052}, {{4.0, 2.5, 1.09}, 0.436974232}, {{4.0, 2.75, 1.09},
0.431270170}, {{4.0, 3.0, 1.09}, 0.429508335}, {{4.5, 1.1, 1.09},
1.444961498}, {{4.5, 1.4, 1.09}, 0.686333174}, {{4.5, 1.7, 1.09},
0.241340533}, {{4.5, 2.0, 1.09}, 0.196898525}, {{4.5, 2.3, 1.09},
0.090722188}, {{4.5, 2.6, 1.09}, 0.069625379}, {{4.5, 2.9, 1.09},
0.164346767}, {{4.5, 3.2, 1.09}, 0.060310736}, {{4.5, 3.5, 1.09},
0.060043745}, {{5.0, 0.85, 1.09},
1.478790428}, {{5.0, 1.55, 1.09}, 0.907162911}, {{5.0, 1.9, 1.09},
0.146692652}, {{5.0, 2.25, 1.09},
0.068423553}, {{5.0, 2.6, 1.09}, 0.025861641}, {{5.0, 2.95, 1.09},
0.024262986}, {{5.0, 3.3, 1.09},
0.017117017}, {{5.0, 3.65, 1.09}, 0.016828180}, {{5.0, 4.0, 1.09},
0.016720068}, {{5.5, 0.9, 1.09}, 1.265758324}, {{5.5, 1.3, 1.09},
0.615352589}, {{5.5, 1.7, 1.09}, 0.272605302}, {{5.5, 2.1, 1.09},
0.110488788}, {{5.5, 2.5, 1.09}, 0.024200467}, {{5.5, 2.9, 1.09},
0.009994316}, {{5.5, 3.3, 1.09}, 0.008007375}, {{5.5, 3.7, 1.09},
0.008099490}, {{5.5, 4.1, 1.09}, 0.007302080}, {{5.5, 4.5, 1.09},
0.007260204}, {{6.0, 1.4, 1.09},
0.596231650}, {{6.0, 1.85, 1.09}, 0.330616964}, {{6.0, 2.3, 1.09},
0.024072686}, {{6.0, 2.75, 1.09},
0.006169812}, {{6.0, 3.2, 1.09}, 0.002498684}, {{6.0, 3.65, 1.09},
0.001787953}, {{6.0, 4.1, 1.09},
0.001654180}, {{6.0, 4.55, 1.09}, 0.001630325}, {{6.0, 5.0, 1.09},
0.001627483}, {{6.5, 1.5, 1.09}, 0.793631092}, {{6.5, 2.0, 1.09},
0.110187997}, {{6.5, 2.5, 1.09}, 0.016842194}, {{6.5, 3.0, 1.09},
0.002372415}, {{6.5, 3.5, 1.09}, 0.000474301}, {{6.5, 4.0, 1.09},
0.000238847}, {{6.5, 4.5, 1.09}, 0.000219469}, {{6.5, 5.0, 1.09},
0.000184626}, {{6.5, 5.5, 1.09}, 0.000183320}, {{7.0, 1.6, 1.09},
0.308273667}, {{7.0, 2.15, 1.09},
0.039753513}, {{7.0, 2.7, 1.09}, 0.010966665}, {{7.0, 3.25, 1.09},
0.001129775}, {{7.0, 3.8, 1.09},
0.000116910}, {{7.0, 4.35, 1.09}, 0.000039600}, {{7.0, 4.9, 1.09},
0.000019400}, {{7.0, 5.45, 1.09},
0.000014700}, {{7.0, 6.0, 1.09}, 0.000014500}, {{7.5, 1.7, 1.09},
0.174931393}, {{7.5, 2.3, 1.09}, 0.063246102}, {{7.5, 2.9, 1.09},
0.002991485}, {{7.5, 3.5, 1.09}, 0.000590735}, {{7.5, 4.1, 1.09},
0.000039400}, {{7.5, 4.7, 1.09}, 0.000009280}, {{7.5, 5.3, 1.09},
0.000002210}, {{7.5, 5.9, 1.09}, 0.000001710}, {{7.5, 6.5, 1.09},
0.000001660}, {{8.0, 1.15, 1.09}, 1.046361422}, {{8.0, 1.8, 1.09},
0.278122089}, {{8.0, 2.45, 1.09},
0.016558807}, {{8.0, 3.1, 1.09}, 0.003216437}, {{8.0, 3.75, 1.09},
0.000098900}, {{8.0, 4.4, 1.09},
0.000015200}, {{8.0, 5.05, 1.09}, 0.000002450}, {{8.0, 5.7, 1.09},
0.000000359}, {{8.0, 6.35, 1.09},
0.000000270}, {{8.0, 7.0, 1.09}, 0.000000247}, {{4.0, 0.75, 1.22},
0.827405236}, {{4.0, 1.0, 1.22},
0.651799818}, {{4.0, 1.25, 1.22}, 0.550867055}, {{4.0, 1.5, 1.22},
0.732196264}, {{4.0, 1.75, 1.22},
0.489067896}, {{4.0, 2.0, 1.22}, 0.414939439}, {{4.0, 2.25, 1.22},
0.401083980}, {{4.0, 2.5, 1.22},
0.395815874}, {{4.0, 2.75, 1.22}, 0.394407293}, {{4.0, 3.0, 1.22},
0.393721204}, {{4.5, 0.5, 1.22}, 1.397909948}, {{4.5, 0.8, 1.22},
0.430095652}, {{4.5, 1.1, 1.22}, 0.442643913}, {{4.5, 1.4, 1.22},
0.178154612}, {{4.5, 1.7, 1.22}, 0.103452285}, {{4.5, 2.0, 1.22},
0.099718220}, {{4.5, 2.3, 1.22}, 0.062246389}, {{4.5, 2.6, 1.22},
0.058320566}, {{4.5, 2.9, 1.22}, 0.092747792}, {{4.5, 3.2, 1.22},
0.054800504}, {{4.5, 3.5, 1.22}, 0.054745922}, {{5.0, 0.5, 1.22},
1.309233137}, {{5.0, 0.85, 1.22},
0.356462115}, {{5.0, 1.2, 1.22}, 0.682953245}, {{5.0, 1.55, 1.22},
0.317639335}, {{5.0, 1.9, 1.22},
0.042458164}, {{5.0, 2.25, 1.22}, 0.032039914}, {{5.0, 2.6, 1.22},
0.016271559}, {{5.0, 2.95, 1.22},
0.016884350}, {{5.0, 3.3, 1.22}, 0.013837963}, {{5.0, 3.65, 1.22},
0.013699974}, {{5.0, 4.0, 1.22}, 0.013694102}, {{5.5, 0.5, 1.22},
1.335122320}, {{5.5, 0.9, 1.22}, 0.330846608}, {{5.5, 1.3, 1.22},
0.140418502}, {{5.5, 1.7, 1.22}, 0.060116609}, {{5.5, 2.1, 1.22},
0.039728185}, {{5.5, 2.5, 1.22}, 0.011414314}, {{5.5, 2.9, 1.22},
0.006026265}, {{5.5, 3.3, 1.22}, 0.005352668}, {{5.5, 3.7, 1.22},
0.005328652}, {{5.5, 4.1, 1.22}, 0.005163881}, {{5.5, 4.5, 1.22},
0.005145367}, {{6.0, 0.95, 1.22},
0.795339637}, {{6.0, 1.4, 1.22}, 0.188595524}, {{6.0, 1.85, 1.22},
0.125782060}, {{6.0, 2.3, 1.22},
0.009643633}, {{6.0, 2.75, 1.22}, 0.003597316}, {{6.0, 3.2, 1.22},
0.002332714}, {{6.0, 3.65, 1.22},
0.002091426}, {{6.0, 4.1, 1.22}, 0.002047402}, {{6.0, 4.55, 1.22},
0.002040056}, {{6.0, 5.0, 1.22}, 0.002039401}, {{6.5, 1.0, 1.22},
0.591819794}, {{6.5, 1.5, 1.22}, 0.226663321}, {{6.5, 2.0, 1.22},
0.024100079}, {{6.5, 2.5, 1.22}, 0.004333508}, {{6.5, 3.0, 1.22},
0.000871749}, {{6.5, 3.5, 1.22}, 0.000343949}, {{6.5, 4.0, 1.22},
0.000269773}, {{6.5, 4.5, 1.22}, 0.000258203}, {{6.5, 5.0, 1.22},
0.000247534}, {{6.5, 5.5, 1.22}, 0.000247053}, {{7.0, 0.5, 1.22},
1.219115691}, {{7.0, 1.05, 1.22},
0.616663469}, {{7.0, 1.6, 1.22}, 0.065444788}, {{7.0, 2.15, 1.22},
0.012306050}, {{7.0, 2.7, 1.22},
0.004155324}, {{7.0, 3.25, 1.22}, 0.000315723}, {{7.0, 3.8, 1.22},
0.000053500}, {{7.0, 4.35, 1.22},
0.000031200}, {{7.0, 4.9, 1.22}, 0.000023300}, {{7.0, 5.45, 1.22},
0.000021400}, {{7.0, 6.0, 1.22}, 0.000021300}, {{7.5, 1.1, 1.22},
0.858211371}, {{7.5, 1.7, 1.22}, 0.047793211}, {{7.5, 2.3, 1.22},
0.020568789}, {{7.5, 2.9, 1.22}, 0.000888049}, {{7.5, 3.5, 1.22},
0.000240608}, {{7.5, 4.1, 1.22}, 0.000012700}, {{7.5, 4.7, 1.22},
0.000005300}, {{7.5, 5.3, 1.22}, 0.000001890}, {{7.5, 5.9, 1.22},
0.000001760}, {{7.5, 6.5, 1.22}, 0.000001740}, {{8.0, 0.5, 1.22},
0.610123090}, {{8.0, 1.15, 1.22},
0.204085228}, {{8.0, 1.8, 1.22}, 0.108996109}, {{8.0, 2.45, 1.22},
0.004407167}, {{8.0, 3.1, 1.22},
0.001163068}, {{8.0, 3.75, 1.22}, 0.000039000}, {{8.0, 4.4, 1.22},
0.000004320}, {{8.0, 5.05, 1.22},
0.000001250}, {{8.0, 5.7, 1.22}, 0.000000274}, {{8.0, 6.35, 1.22},
0.000000250}, {{8.0, 7.0, 1.22}, 0.000000242}, {{4.0, 0.5, 1.35},
1.454009532}, {{4.0, 0.75, 1.35},
0.737302768}, {{4.0, 1.0, 1.35}, 0.695863190}, {{4.0, 1.25, 1.35},
0.419651243}, {{4.0, 1.5, 1.35},
0.367032344}, {{4.0, 1.75, 1.35}, 0.350729234}, {{4.0, 2.0, 1.35},
0.349897581}, {{4.0, 2.25, 1.35},
0.333441527}, {{4.0, 2.5, 1.35}, 0.341522354}, {{4.0, 2.75, 1.35},
0.315102412}, {{4.0, 3.0, 1.35}, 0.314926583}, {{4.5, 0.5, 1.35},
0.388560352}, {{4.5, 0.8, 1.35}, 0.487646106}, {{4.5, 1.1, 1.35},
0.165658796}, {{4.5, 1.4, 1.35}, 0.227813004}, {{4.5, 1.7, 1.35},
0.297338831}, {{4.5, 2.0, 1.35}, 0.094717580}, {{4.5, 2.3, 1.35},
0.093686941}, {{4.5, 2.6, 1.35}, 0.080034287}, {{4.5, 2.9, 1.35},
0.080633234}, {{4.5, 3.2, 1.35}, 0.080844649}, {{4.5, 3.5, 1.35},
0.078826313}, {{5.0, 0.5, 1.35},
0.322520537}, {{5.0, 0.85, 1.35}, 0.707410293}, {{5.0, 1.2, 1.35},
0.614034917}, {{5.0, 1.55, 1.35},
0.091899603}, {{5.0, 1.9, 1.35}, 0.066329929}, {{5.0, 2.25, 1.35},
0.029550701}, {{5.0, 2.6, 1.35},
0.030453692}, {{5.0, 2.95, 1.35}, 0.029791613}, {{5.0, 3.3, 1.35},
0.023075545}, {{5.0, 3.65, 1.35},
0.023114001}, {{5.0, 4.0, 1.35}, 0.023049641}, {{5.5, 0.5, 1.35},
0.441321244}, {{5.5, 0.9, 1.35}, 0.089405211}, {{5.5, 1.3, 1.35},
0.186011588}, {{5.5, 1.7, 1.35}, 0.070581961}, {{5.5, 2.1, 1.35},
0.014755718}, {{5.5, 2.5, 1.35}, 0.002624525}, {{5.5, 2.9, 1.35},
0.004911564}, {{5.5, 3.3, 1.35}, 0.001038136}, {{5.5, 3.7, 1.35},
0.000935360}, {{5.5, 4.1, 1.35}, 0.000608730}, {{5.5, 4.5, 1.35},
0.000600248}, {{6.0, 0.5, 1.35}, 0.885005228}, {{6.0, 0.95, 1.35},
0.135485436}, {{6.0, 1.4, 1.35},
0.058295957}, {{6.0, 1.85, 1.35}, 0.032526734}, {{6.0, 2.3, 1.35},
0.003598455}, {{6.0, 2.75, 1.35},
0.002546465}, {{6.0, 3.2, 1.35}, 0.002242820}, {{6.0, 3.65, 1.35},
0.001139092}, {{6.0, 4.1, 1.35},
0.000951446}, {{6.0, 4.55, 1.35}, 0.000924755}, {{6.0, 5.0, 1.35},
0.000920676}, {{6.5, 0.5, 1.35}, 0.263613572}, {{6.5, 1.0, 1.35},
0.152288855}, {{6.5, 1.5, 1.35}, 0.269819439}, {{6.5, 2.0, 1.35},
0.030683146}, {{6.5, 2.5, 1.35}, 0.006681324}, {{6.5, 3.0, 1.35},
0.001501128}, {{6.5, 3.5, 1.35}, 0.000562310}, {{6.5, 4.0, 1.35},
0.000185674}, {{6.5, 4.5, 1.35}, 0.000179138}, {{6.5, 5.0, 1.35},
0.000177167}, {{6.5, 5.5, 1.35}, 0.000177332}, {{7.0, 0.5, 1.35},
0.358269736}, {{7.0, 1.05, 1.35},
0.232864653}, {{7.0, 1.6, 1.35}, 0.079521231}, {{7.0, 2.15, 1.35},
0.010670201}, {{7.0, 2.7, 1.35},
0.001466776}, {{7.0, 3.25, 1.35}, 0.000502468}, {{7.0, 3.8, 1.35},
0.000109715}, {{7.0, 4.35, 1.35},
0.000029100}, {{7.0, 4.9, 1.35}, 0.000030100}, {{7.0, 5.45, 1.35},
0.000026100}, {{7.0, 6.0, 1.35}, 0.000026000}, {{7.5, 0.5, 1.35},
0.765503507}, {{7.5, 1.1, 1.35}, 0.225309312}, {{7.5, 1.7, 1.35},
0.075578397}, {{7.5, 2.3, 1.35}, 0.035761409}, {{7.5, 2.9, 1.35},
0.001994473}, {{7.5, 3.5, 1.35}, 0.000098300}, {{7.5, 4.1, 1.35},
0.000023100}, {{7.5, 4.7, 1.35}, 0.000006860}, {{7.5, 5.3, 1.35},
0.000002100}, {{7.5, 5.9, 1.35}, 0.000001850}, {{7.5, 6.5, 1.35},
0.000001840}, {{8.0, 0.5, 1.35},
0.160260107}, {{8.0, 1.15, 1.35}, 0.191520629}, {{8.0, 1.8, 1.35},
0.136761248}, {{8.0, 2.45, 1.35},
0.007668079}, {{8.0, 3.1, 1.35}, 0.002353801}, {{8.0, 3.75, 1.35},
0.000016500}, {{8.0, 4.4, 1.35},
0.000007090}, {{8.0, 5.05, 1.35}, 0.000001720}, {{8.0, 5.7, 1.35},
0.000000385}, {{8.0, 6.35, 1.35},
0.000000334}, {{8.0, 7.0, 1.35}, 0.000000318}, {{4.0, 0.5, 1.48},
0.470479937}, {{4.0, 0.75, 1.48}, 0.367620448}, {{4.0, 1.0, 1.48},
0.340890658}, {{4.0, 1.25, 1.48},
0.317231611}, {{4.0, 1.5, 1.48}, 0.316392156}, {{4.0, 1.75, 1.48},
0.311104152}, {{4.0, 2.0, 1.48},
0.307808272}, {{4.0, 2.25, 1.48}, 0.304180373}, {{4.0, 2.5, 1.48},
0.302495782}, {{4.0, 2.75, 1.48},
0.301827393}, {{4.0, 3.0, 1.48}, 0.301759528}, {{4.5, 0.5, 1.48},
0.171581112}, {{4.5, 0.8, 1.48}, 0.148034915}, {{4.5, 1.1, 1.48},
0.119562673}, {{4.5, 1.4, 1.48}, 0.120956918}, {{4.5, 1.7, 1.48},
0.103986513}, {{4.5, 2.0, 1.48}, 0.100174635}, {{4.5, 2.3, 1.48},
0.097848797}, {{4.5, 2.6, 1.48}, 0.096017518}, {{4.5, 2.9, 1.48},
0.095956891}, {{4.5, 3.2, 1.48}, 0.095646915}, {{4.5, 3.5, 1.48},
0.095586057}, {{5.0, 0.5, 1.48}, 0.116857397}, {{5.0, 0.85, 1.48},
0.074113303}, {{5.0, 1.2, 1.48},
0.152334944}, {{5.0, 1.55, 1.48}, 0.051069341}, {{5.0, 1.9, 1.48},
0.038521468}, {{5.0, 2.25, 1.48},
0.034140043}, {{5.0, 2.6, 1.48}, 0.032123945}, {{5.0, 2.95, 1.48},
0.034528591}, {{5.0, 3.3, 1.48},
0.031342263}, {{5.0, 3.65, 1.48}, 0.031338895}, {{5.0, 4.0, 1.48},
0.031327580}, {{5.5, 0.5, 1.48}, 0.174695986}, {{5.5, 0.9, 1.48},
0.024606063}, {{5.5, 1.3, 1.48}, 0.023593247}, {{5.5, 1.7, 1.48},
0.013250544}, {{5.5, 2.1, 1.48}, 0.004671462}, {{5.5, 2.5, 1.48},
0.001344497}, {{5.5, 2.9, 1.48}, 0.000927703}, {{5.5, 3.3, 1.48},
0.000744270}, {{5.5, 3.7, 1.48}, 0.000750684}, {{5.5, 4.1, 1.48},
0.000661253}, {{5.5, 4.5, 1.48}, 0.000657167}, {{6.0, 0.5, 1.48},
0.171688520}, {{6.0, 0.95, 1.48},
0.037318337}, {{6.0, 1.4, 1.48}, 0.020935844}, {{6.0, 1.85, 1.48},
0.010770763}, {{6.0, 2.3, 1.48},
0.001978291}, {{6.0, 2.75, 1.48}, 0.001383724}, {{6.0, 3.2, 1.48},
0.001187968}, {{6.0, 3.65, 1.48},
0.001118549}, {{6.0, 4.1, 1.48}, 0.001102419}, {{6.0, 4.55, 1.48},
0.001099128}, {{6.0, 5.0, 1.48}, 0.001098510}, {{6.5, 0.5, 1.48},
0.068587277}, {{6.5, 1.0, 1.48}, 0.046848262}, {{6.5, 1.5, 1.48},
0.041946536}, {{6.5, 2.0, 1.48}, 0.006275392}, {{6.5, 2.5, 1.48},
0.001426437}, {{6.5, 3.0, 1.48}, 0.000355457}, {{6.5, 3.5, 1.48},
0.000169468}, {{6.5, 4.0, 1.48}, 0.000139882}, {{6.5, 4.5, 1.48},
0.000137259}, {{6.5, 5.0, 1.48}, 0.000136512}, {{6.5, 5.5, 1.48},
0.000136641}, {{7.0, 0.5, 1.48},
0.112742025}, {{7.0, 1.05, 1.48}, 0.049215071}, {{7.0, 1.6, 1.48},
0.013549062}, {{7.0, 2.15, 1.48},
0.001826628}, {{7.0, 2.7, 1.48}, 0.000537032}, {{7.0, 3.25, 1.48},
0.000141105}, {{7.0, 3.8, 1.48},
0.000038400}, {{7.0, 4.35, 1.48}, 0.000027300}, {{7.0, 4.9, 1.48},
0.000028400}, {{7.0, 5.45, 1.48},
0.000026100}, {{7.0, 6.0, 1.48}, 0.000026100}, {{7.5, 0.5, 1.48},
0.191399751}, {{7.5, 1.1, 1.48}, 0.042342404}, {{7.5, 1.7, 1.48},
0.006991319}, {{7.5, 2.3, 1.48}, 0.006516285}, {{7.5, 2.9, 1.48},
0.000284753}, {{7.5, 3.5, 1.48}, 0.000039100}, {{7.5, 4.1, 1.48},
0.000006440}, {{7.5, 4.7, 1.48}, 0.000004360}, {{7.5, 5.3, 1.48},
0.000001930}, {{7.5, 5.9, 1.48}, 0.000001870}, {{7.5, 6.5, 1.48},
0.000001870}, {{8.0, 0.5, 1.48}, 0.042009734}, {{8.0, 1.15, 1.48},
0.034969534}, {{8.0, 1.8, 1.48},
0.068638665}, {{8.0, 2.45, 1.48}, 0.001238419}, {{8.0, 3.1, 1.48},
0.000505915}, {{8.0, 3.75, 1.48},
0.000006690}, {{8.0, 4.4, 1.48}, 0.000002110}, {{8.0, 5.05, 1.48},
0.000001170}, {{8.0, 5.7, 1.48},
0.000000360}, {{8.0, 6.35, 1.48}, 0.000000351}, {{8.0, 7.0, 1.48},
0.000000347}, {{4.0, 0.5, 1.61},
0.442993049}, {{4.0, 0.75, 1.61}, 0.433506362}, {{4.0, 1.0, 1.61},
0.428023917}, {{4.0, 1.25, 1.61},
0.424278915}, {{4.0, 1.5, 1.61}, 0.432292916}, {{4.0, 1.75, 1.61},
0.423051232}, {{4.0, 2.0, 1.61},
0.421833461}, {{4.0, 2.25, 1.61}, 0.421056046}, {{4.0, 2.5, 1.61},
0.420698219}, {{4.0, 2.75, 1.61},
0.420601196}, {{4.0, 3.0, 1.61}, 0.420576087}, {{4.5, 0.5, 1.61},
0.079797092}, {{4.5, 0.8, 1.61}, 0.069004619}, {{4.5, 1.1, 1.61},
0.066212212}, {{4.5, 1.4, 1.61}, 0.063833930}, {{4.5, 1.7, 1.61},
0.060338827}, {{4.5, 2.0, 1.61}, 0.060037234}, {{4.5, 2.3, 1.61},
0.059176593}, {{4.5, 2.6, 1.61}, 0.058833063}, {{4.5, 2.9, 1.61},
0.060047219}, {{4.5, 3.2, 1.61}, 0.058698631}, {{4.5, 3.5, 1.61},
0.058689419}, {{5.0, 0.5, 1.61}, 0.036286735}, {{5.0, 0.85, 1.61},
0.024585617}, {{5.0, 1.2, 1.61},
0.064207423}, {{5.0, 1.55, 1.61}, 0.023200253}, {{5.0, 1.9, 1.61},
0.017783631}, {{5.0, 2.25, 1.61},
0.016861914}, {{5.0, 2.6, 1.61}, 0.016435642}, {{5.0, 2.95, 1.61},
0.016410468}, {{5.0, 3.3, 1.61},
0.016269286}, {{5.0, 3.65, 1.61}, 0.016265428}, {{5.0, 4.0, 1.61},
0.016260452}, {{5.5, 0.5, 1.61}, 0.025862558}, {{5.5, 0.9, 1.61},
0.012959597}, {{5.5, 1.3, 1.61}, 0.011164651}, {{5.5, 1.7, 1.61},
0.009266832}, {{5.5, 2.1, 1.61}, 0.007711323}, {{5.5, 2.5, 1.61},
0.006852589}, {{5.5, 2.9, 1.61}, 0.006663697}, {{5.5, 3.3, 1.61},
0.006625660}, {{5.5, 3.7, 1.61}, 0.006655079}, {{5.5, 4.1, 1.61},
0.006605237}, {{5.5, 4.5, 1.61}, 0.006604260}, {{6.0, 0.5, 1.61},
0.069386605}, {{6.0, 0.95, 1.61},
0.017644090}, {{6.0, 1.4, 1.61}, 0.005568278}, {{6.0, 1.85, 1.61},
0.004963031}, {{6.0, 2.3, 1.61},
0.001892505}, {{6.0, 2.75, 1.61}, 0.001697214}, {{6.0, 3.2, 1.61},
0.001638167}, {{6.0, 3.65, 1.61},
0.001621715}, {{6.0, 4.1, 1.61}, 0.001617843}, {{6.0, 4.55, 1.61},
0.001617022}, {{6.0, 5.0, 1.61}, 0.001616871}, {{6.5, 0.5, 1.61},
0.031140290}, {{6.5, 1.0, 1.61}, 0.010471933}, {{6.5, 1.5, 1.61},
0.005519495}, {{6.5, 2.0, 1.61}, 0.001558053}, {{6.5, 2.5, 1.61},
0.000485185}, {{6.5, 3.0, 1.61}, 0.000234659}, {{6.5, 3.5, 1.61},
0.000189712}, {{6.5, 4.0, 1.61}, 0.000182987}, {{6.5, 4.5, 1.61},
0.000182630}, {{6.5, 5.0, 1.61}, 0.000181682}, {{6.5, 5.5, 1.61},
0.000181646}, {{7.0, 0.5, 1.61},
0.017778435}, {{7.0, 1.05, 1.61}, 0.011274790}, {{7.0, 1.6, 1.61},
0.002863776}, {{7.0, 2.15, 1.61},
0.000487258}, {{7.0, 2.7, 1.61}, 0.000189667}, {{7.0, 3.25, 1.61},
0.000046300}, {{7.0, 3.8, 1.61},
0.000018800}, {{7.0, 4.35, 1.61}, 0.000016200}, {{7.0, 4.9, 1.61},
0.000015800}, {{7.0, 5.45, 1.61},
0.000015600}, {{7.0, 6.0, 1.61}, 0.000015600}, {{7.5, 0.5, 1.61},
0.050953841}, {{7.5, 1.1, 1.61}, 0.017313563}, {{7.5, 1.7, 1.61},
0.001559453}, {{7.5, 2.3, 1.61}, 0.000814265}, {{7.5, 2.9, 1.61},
0.000069000}, {{7.5, 3.5, 1.61}, 0.000015100}, {{7.5, 4.1, 1.61},
0.000002880}, {{7.5, 4.7, 1.61}, 0.000001770}, {{7.5, 5.3, 1.61},
0.000001630}, {{7.5, 5.9, 1.61}, 0.000001610}, {{7.5, 6.5, 1.61},
0.000001610}, {{8.0, 0.5, 1.61}, 0.010874615}, {{8.0, 1.15, 1.61},
0.007300882}, {{8.0, 1.8, 1.61},
0.002246821}, {{8.0, 2.45, 1.61}, 0.000284699}, {{8.0, 3.1, 1.61},
0.000071900}, {{8.0, 3.75, 1.61},
0.000002590}, {{8.0, 4.4, 1.61}, 0.000000754}, {{8.0, 5.05, 1.61},
0.000000284}, {{8.0, 5.7, 1.61},
0.000000241}, {{8.0, 6.35, 1.61}, 0.000000238}, {{8.0, 7.0, 1.61},
0.000000237}, {{4.0, 0.5, 1.74},
0.323104169}, {{4.0, 0.75, 1.74}, 0.318312048}, {{4.0, 1.0, 1.74},
0.316719842}, {{4.0, 1.25, 1.74},
0.314226189}, {{4.0, 1.5, 1.74}, 0.314014779}, {{4.0, 1.75, 1.74},
0.313672902}, {{4.0, 2.0, 1.74},
0.313544269}, {{4.0, 2.25, 1.74}, 0.313201194}, {{4.0, 2.5, 1.74},
0.313057926}, {{4.0, 2.75, 1.74},
0.312888339}, {{4.0, 3.0, 1.74}, 0.312879266}, {{4.5, 0.5, 1.74},
0.083854404}, {{4.5, 0.8, 1.74}, 0.083373467}, {{4.5, 1.1, 1.74},
0.080409317}, {{4.5, 1.4, 1.74}, 0.081044293}, {{4.5, 1.7, 1.74},
0.079989750}, {{4.5, 2.0, 1.74}, 0.079122284}, {{4.5, 2.3, 1.74},
0.079017545}, {{4.5, 2.6, 1.74}, 0.078774112}, {{4.5, 2.9, 1.74},
0.078780611}, {{4.5, 3.2, 1.74}, 0.078746618}, {{4.5, 3.5, 1.74},
0.078726627}, {{5.0, 0.5, 1.74}, 0.028146359}, {{5.0, 0.85, 1.74},
0.027605669}, {{5.0, 1.2, 1.74},
0.032351324}, {{5.0, 1.55, 1.74}, 0.024678749}, {{5.0, 1.9, 1.74},
0.023809156}, {{5.0, 2.25, 1.74},
0.023274787}, {{5.0, 2.6, 1.74}, 0.023162824}, {{5.0, 2.95, 1.74},
0.023366666}, {{5.0, 3.3, 1.74},
0.023037002}, {{5.0, 3.65, 1.74}, 0.023037840}, {{5.0, 4.0, 1.74},
0.023035953}, {{5.5, 0.5, 1.74}, 0.009065005}, {{5.5, 0.9, 1.74},
0.002268956}, {{5.5, 1.3, 1.74}, 0.002878853}, {{5.5, 1.7, 1.74},
0.001843395}, {{5.5, 2.1, 1.74}, 0.000985718}, {{5.5, 2.5, 1.74},
0.000681261}, {{5.5, 2.9, 1.74}, 0.000667357}, {{5.5, 3.3, 1.74},
0.000626572}, {{5.5, 3.7, 1.74}, 0.000627009}, {{5.5, 4.1, 1.74},
0.000612744}, {{5.5, 4.5, 1.74}, 0.000612251}, {{6.0, 0.5, 1.74},
0.013409102}, {{6.0, 0.95, 1.74},
0.003370299}, {{6.0, 1.4, 1.74}, 0.002331664}, {{6.0, 1.85, 1.74},
0.001786354}, {{6.0, 2.3, 1.74},
0.000977334}, {{6.0, 2.75, 1.74}, 0.000931682}, {{6.0, 3.2, 1.74},
0.000912320}, {{6.0, 3.65, 1.74},
0.000897512}, {{6.0, 4.1, 1.74}, 0.000893837}, {{6.0, 4.55, 1.74},
0.000893091}, {{6.0, 5.0, 1.74}, 0.000892948}, {{6.5, 0.5, 1.74},
0.004584271}, {{6.5, 1.0, 1.74}, 0.003132308}, {{6.5, 1.5, 1.74},
0.003010549}, {{6.5, 2.0, 1.74}, 0.000812634}, {{6.5, 2.5, 1.74},
0.000336534}, {{6.5, 3.0, 1.74}, 0.000209365}, {{6.5, 3.5, 1.74},
0.000181780}, {{6.5, 4.0, 1.74}, 0.000174948}, {{6.5, 4.5, 1.74},
0.000174585}, {{6.5, 5.0, 1.74}, 0.000174473}, {{6.5, 5.5, 1.74},
0.000174489}, {{7.0, 0.5, 1.74},
0.006454375}, {{7.0, 1.05, 1.74}, 0.004234118}, {{7.0, 1.6, 1.74},
0.001330095}, {{7.0, 2.15, 1.74},
0.000228120}, {{7.0, 2.7, 1.74}, 0.000081300}, {{7.0, 3.25, 1.74},
0.000044900}, {{7.0, 3.8, 1.74},
0.000030100}, {{7.0, 4.35, 1.74}, 0.000027800}, {{7.0, 4.9, 1.74},
0.000027900}, {{7.0, 5.45, 1.74},
0.000027600}, {{7.0, 6.0, 1.74}, 0.000027600}, {{7.5, 0.5, 1.74},
0.012450682}, {{7.5, 1.1, 1.74}, 0.003456252}, {{7.5, 1.7, 1.74},
0.000808937}, {{7.5, 2.3, 1.74}, 0.000544727}, {{7.5, 2.9, 1.74},
0.000047500}, {{7.5, 3.5, 1.74}, 0.000006510}, {{7.5, 4.1, 1.74},
0.000002680}, {{7.5, 4.7, 1.74}, 0.000002180}, {{7.5, 5.3, 1.74},
0.000001830}, {{7.5, 5.9, 1.74}, 0.000001820}, {{7.5, 6.5, 1.74},
0.000001820}, {{8.0, 0.5, 1.74}, 0.002765904}, {{8.0, 1.15, 1.74},
0.002914385}, {{8.0, 1.8, 1.74},
0.005676367}, {{8.0, 2.45, 1.74}, 0.000163614}, {{8.0, 3.1, 1.74},
0.000056000}, {{8.0, 3.75, 1.74},
0.000001180}, {{8.0, 4.4, 1.74}, 0.000000635}, {{8.0, 5.05, 1.74},
0.000000422}, {{8.0, 5.7, 1.74},
0.000000318}, {{8.0, 6.35, 1.74}, 0.000000316}, {{8.0, 7.0, 1.74},
0.000000315}};


The data is 4 dimensional, x, y, z, value. One way to visualize would be to use ListPlot3D for x, y, z and a ColorFunction based on the Interpolation for the values. e.g.

ListPlot3D[data[[All, 1]],
ColorFunction -> Function[{x, y, z}, ColorData["TemperatureMap"]@func[x, y, z]],
ColorFunctionScaling -> False,
ImageSize -> 500]


• Thank you very much! That was exactly what I was trying to do. Do you happen to have any idea how I might get the explicit function definition (something like f(x,y,z) = val) from the interpolation as well? Nov 27, 2021 at 23:24
• Not sure what you mean by "explicit function". func is an InterpolatingFunction and behaves just like Function. You can take its derivative, integrate it, ... Nov 27, 2021 at 23:32
• Wow! Thanks! I didn't know I could take the derivative of it. I just was looking for some way to write it as something like f(x,y,z) = x^3 + 5y + z -8 or something like that. My main goal is to use this function in gradient descent method optimization so I thought I needed it but now I'm thinking it may be possible to work without it. Nov 27, 2021 at 23:36
• Actually, now that I am trying to take the derivative it is not working. Is there a way to get Mathematica to output the function similar to something that I wrote in the previous comment? Nov 27, 2021 at 23:39
• If you have a model that you expect the data to follow then you may be able to fit the model to the data to obtain values for the parameters. There is a way to extract a polynomial from an InterpolatingFunction as described here but it only works for 1D data using Hermite interpolation. Nov 28, 2021 at 0:04

Your data is the form f(x,y,z)= loss, so we need to use ListContourPlot3Dand change the data {{x,y,z},loss} to {x,y,z,loss}

ListContourPlot3D[Flatten /@ data, PlotRange -> All, Contours -> 20,
PlotLegends -> "Expressions", Mesh -> None,
MaxPlotPoints -> Automatic]


And the gradient of interpolation function for example at point {6, 2, 1} is

f = Interpolation[data, InterpolationOrder -> 1];
Grad[f[x, y, z], {x, y, z}] /. Thread[{x, y, z} -> {6, 2, 1}]

Through[{Derivative[1, 0, 0][f], Derivative[0, 1, 0][f],
Derivative[0, 0, 1][f]} @@ {6, 2, 1}]


{-0.816954, -1.64864, -0.316834}

• Thank you very much! I love this way of visualizing the data and also the gradient code is extraordinarily helpful. I was struggling with that part. Nov 28, 2021 at 14:30