A homology theory is developed for set-theoretic Yang-Baxter equations, and knot invariants are constructed by generalized colorings by biquandles and Yang-Baxter cocycles.