I am working on an interesting project, which requires I use the huber function on a set of variables and just the square function on the other variables. For example, I have a vector function looking like this f(x, z) = (H(x),S(z))
, where H(x)
is the huber function with a specified parameter and S(z)
is the square function.
Ultimately, x
, z
are parts of x_bar
. I am wondering if anyone knew of any unique way to do this in function, without indexing the arrays, i.e. x,z = x_bar[:n],x_bar[n:]
.
Thank you for your help.
EDIT:
I am sorry for the confusion.
Firstly, I will start with the inputs to my functions. I have a vector called x_bar, which I have defined to be the concatentation of two different vectors x and z. These vectors can belong to different dimensional spaces. Let us say x is a n-dimensional vector and z is a m-dimensional vector.
Secondly, I am defining (x,z) to be concatentation of the vectors x and z. So when I wrote f(x,z) = ( H(x), S(z) ), I am stating that f(x,z) is the concatenation of H(x) and S(z). Please assume H(x) is a vector-valued function and S(z) is a vector valued function, still performing the operators I specified in the original comment.
Thirdly, I am writing a custom loss function in python and I was hoping to use x_bar as my primary input and setting x, z = x_bar[:n], x_bar[n:], where x_bar[:n] is slicing the array and referencing only the first n components.