市值: $3.3108T -0.840%
成交额(24h): $101.8321B 28.100%
  • 市值: $3.3108T -0.840%
  • 成交额(24h): $101.8321B 28.100%
  • 恐惧与贪婪指数:
  • 市值: $3.3108T -0.840%
加密货币
话题
百科
资讯
加密话题
视频
热门新闻
加密货币
话题
百科
资讯
加密话题
视频
bitcoin
bitcoin

$107167.915651 USD

-1.23%

ethereum
ethereum

$2484.735224 USD

-0.65%

tether
tether

$1.000551 USD

0.03%

xrp
xrp

$2.227485 USD

1.25%

bnb
bnb

$657.234657 USD

0.38%

solana
solana

$153.359085 USD

0.76%

usd-coin
usd-coin

$1.000234 USD

0.03%

tron
tron

$0.279694 USD

1.12%

dogecoin
dogecoin

$0.164283 USD

-2.04%

cardano
cardano

$0.566559 USD

-0.46%

hyperliquid
hyperliquid

$39.355826 USD

-3.77%

bitcoin-cash
bitcoin-cash

$520.939018 USD

3.97%

sui
sui

$2.773602 USD

-2.77%

chainlink
chainlink

$13.247285 USD

-2.04%

unus-sed-leo
unus-sed-leo

$9.098882 USD

-0.71%

加密货币新闻

Solving a Rubik's Cube with Supervised Learning — Intuitively and Exhaustively Explained

2025/01/10 23:05

Solving a Rubik's Cube with Supervised Learning — Intuitively and Exhaustively Explained

Solving a Rubik's Cube with Deep Learning

A step-by-step guide to building a model that can solve a Rubik's Cube

Daniel Warfield

Follow

Towards Data Science

--

Share

In this article we’ll build a deep learning model that can solve a Rubik's Cube. We’ll define our own dataset, make a transformer style model that can learn based on that dataset, and use that model to solve new and randomly shuffled Rubik's Cubes.

In tackling this problem we’ll discuss practical problems which come up frequently in data science, and the techniques data scientists use to solve those problems.

Who is this useful for? Anyone interested in achieving mastery of modern AI.

How advanced is this post? This post covers advanced modeling strategies intuitively, and is appropriate for readers of all levels.

Pre-requisites: There are no prerequisites for this article, though an understanding of transformer style models may be useful for some of the later, code heavy sections.

References: A link to the code and supporting resources can be found in the reference section at the end of this article.

Defining a Rubik's Cube as a Modeling Problem

As you likely know, the Rubik's Cube is a geometric game featuring a 3x3x3 cube with different colored squares on each of its six faces. The goal of the game is to manipulate the cube in order to return it to its original state, with each face displaying a single, uniform color.

We can define a Rubik's Cube in terms of a sequence of moves. Each move corresponds to a 90-degree rotation of one of the cube's six faces. We can represent a move using a single character, where F corresponds to a clockwise rotation of the front face, B corresponds to a clockwise rotation of the back face, L corresponds to a clockwise rotation of the left face, R corresponds to a clockwise rotation of the right face, U corresponds to a clockwise rotation of the upper face, and D corresponds to a clockwise rotation of the lower face.

For example, the sequence of moves "FRUR'D'" corresponds to a clockwise rotation of the front face, followed by a clockwise rotation of the right face, followed by a counter-clockwise rotation of the upper face, and finally followed by a counter-clockwise rotation of the lower face.

We can use this notation to define any possible state of a Rubik's Cube. For example, the starting state of a Rubik's Cube can be represented by the following sequence of moves:

```

UUUUUUUUURRRRRRRRRFFFFFFFFFDDDDDDDDDLLLLLLLLLLBBBBBBBBB

```

This sequence of moves corresponds to the following sequence of rotations:

```

U -> R -> U -> R -> U -> R -> U -> R -> U -> U -> U -> U -> U -> U -> U

```

We can apply this sequence of rotations to a scrambled Rubik's Cube in order to return it to its starting state.

We can now define the modeling problem as follows: given a scrambled Rubik's Cube, we want to predict the sequence of moves that will return the cube to its starting state.

免责声明:info@kdj.com

所提供的信息并非交易建议。根据本文提供的信息进行的任何投资,kdj.com不承担任何责任。加密货币具有高波动性,强烈建议您深入研究后,谨慎投资!

如您认为本网站上使用的内容侵犯了您的版权,请立即联系我们(info@kdj.com),我们将及时删除。

2025年07月01日 发表的其他文章