One of the most common kinds of cancer in the United States is skin cancer. This kind of cancer occurs when the cells that make up the skin layer grow uncontrollably and divide rapidly. To avoid the skin cancer harms, it is better to detect it in the early stages. Due to complexity of the diagnosis, some times, the experts provide an incorrect diagnosis about this cancer. Therefore, proposing a computer-aided system, not as an independent system, but as an auxiliary tool along with the physicians, can help them in more accurate detection of this kind of cancer. This study introduced an optimal and efficient computer-assisted system for skin cancer analysis. Here, deep training and metaheuristic techniques are used for this purpose. The main idea is to provide a Deep Belief Network (DBN), based on an improved metaheuristic technique, called Modified Electromagnetic Field Opti-mization Algorithm (MEFOA) to provide a strong diagnosis system for the images of skin cancer. The function of the proposed method is proved through a comparison between its results and some other related works.