Question: Can anyone suggest to me some beginner study material for Machine learning applications in fields of 

1) Financial forecasting and

2) Online advertisement?

Thanks in advance!

Answer: 
I think it would be best if you would define $g$ in plain words, e.g. first define $$A\_b = \{a \mid \forall a' \in A.\ f(a,b) \geq f(a', b)\}$$ and then say that $$g : B \to A \quad \quad \text{ or } \quad \quad g : B \to \bigcup\_{b \in B}A\_b$$ is a function that assigns any $b \in B$ a random element from $A\_b$ (I guess that your $A\_b$ is finite and random means uniform distribution). 

However, be aware that this isn't very formal. The problem isn't that its text (there is no problem with text-only definition being formal), but the notion of randomness. To speak about random events and probability you need to define a probability space (usually denoted $\Omega$) and your function would have to depend on it, that is, in math you could have one function

$$g : \Omega \times B \to A$$

or a set

$$g\_b : \Omega \to A\_b$$

for $b \in B$. To emphasize the difference, *functions* are deterministic by definition, i.e. for same inputs you get the same outputs. The usual computer-science $\mathtt{rand}$ is not a function, because for same input it returns different outputs (the same goes for things which read from $\mathtt{stdin}$, etc.). Therefore, to simulate the probabilistic behavior, you introduce a dependency on the probability space. That might get messy (I am not saying that it will, only that it might), so I would advise you to avoid formality in this case (unless you really need it), just make the textual description clear enough to get the meaning through.

Some other thoughts, I'm not sure, but it might be easier for you to define a relation $\leq\_b$ by $x \leq\_b y \iff f(x,b) \leq f(y,b)$ instead of writing $f(x,b)$ everywhere. On the other hand, the construction of $A\_b$ suggests that $\leq\_b$ is not a partial order, as so consider using some other symbol, as $\leq\_b$ might be misleading.

I hope that helps $\ddot\smile$
Leaving aside the particular conditions that you want your element $a \in A$ corresponding to an element $b \in B$ to satisfy, I can think of three different ways to talk about what you want to talk about.

1. You could simply consider the collection $\mathcal{C}$ of all functions $g : B \to A$ such that for all $a \in A$ the element $g(a)$ satisfies the desired condition. You could talk about an *arbitrary* element $g$ of this collection $\mathcal{C}$. This might not be completely satisfactory, because "arbitrary" is not quite the same as "random".
2. You could talk about set-valued functions $G: B \to \mathcal{P}(A)$ where $\mathcal{P}(A)$ denotes the power set of $A$. Defining $G(b)$ to be the set of *all* $a \in A$ satisfying the desired condition, this gives you a single object $G$ embodying your condition. You can proceed to talk about arbitrary elements of $G(b)$, but again "arbitrary" is not quite the same as "random".
3. You could let $(\Omega,\mathcal{F},P)$ denote a [probability space](https://en.wikipedia.org/wiki/Probability_space), and consider functions $G : B \times \Omega \to A$. This is the method that would best capture the mathematical meaning of "random". However, it is rather technically involved, and you will have to put extra struction or $A$ and $B$ (namely, $\sigma$-algebras) and require the function $f$ to respect this structure in some way (namely, to be measurable.)