Representation Learning with Weighted Inner Product for Universal Approximation of General Similarities