Applications of neural networks in astronomy and astroparticle physics